Memo : Flutter x Dart [2015-2016]
Ctrlk
  • Introduction
  • hello
  • rendering
  • widget
  • dart:io
    • HttpClient Post & Get
    • NetworkInterface
    • TCP Socket
    • UDP Socket
    • File Path(dart:io & service)
    • File Create & Permission
  • dart:ui
  • mojo for flutter
  • 2d physics for scratch
  • 2d physics for newton
  • mojo for native
  • 48 hour trial
Powered by GitBook
On this page
  1. dart:io

NetworkInterface

https://github.com/kyorohiro/hello_skyengine/tree/master/dartio_networkinterface

  • [ERROR]

    https://github.com/flutter/engine/issues/1655

PreviousHttpClient Post & GetNextTCP Socket

Last updated 5 years ago

Was this helpful?

Was this helpful?

// following code is checked in 2016/01/13
import 'package:flutter/widgets.dart';
import 'dart:io';
import 'dart:convert';
import 'dart:async';

main() async {
  try {
    //
    // 2015/10/16
    //
    // begining of crash
    Text t = new Text("${await getNetworkInterface()}");
    Center c = new Center(child: t);
    runApp(c);
  } catch (e) {
    print(e);
  }
}

Future<String> getNetworkInterface() async {
  List<NetworkInterface> interfaces = await NetworkInterface.list(
      includeLoopback: true, includeLinkLocal: true);
  StringBuffer buffer = new StringBuffer();
  for (NetworkInterface i in interfaces) {
    buffer.write("${i.addresses} ${i.name}");
  }
  return buffer.toString();
}