wifi_info_plugin 1.0.3 copy "wifi_info_plugin: ^1.0.3" to clipboard
wifi_info_plugin: ^1.0.3 copied to clipboard

outdated

Wifi info wrapper android plugin,plugin serves as a bridge from flutter currently to android native code to retrieve Network info from example device Ip and Mac Address. IOS implemetation will be real [...]

example/lib/main.dart

import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:wifi_info_plugin/wifi_info_plugin.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  WifiInfoWrapper _wifiObject;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    WifiInfoWrapper wifiObject;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      wifiObject = await WifiInfoPlugin.wifiDetails;
    } on PlatformException {}
    if (!mounted) return;

    setState(() {
      _wifiObject = wifiObject;
    });
  }

  @override
  Widget build(BuildContext context) {
    String ipAddress =
        _wifiObject != null ? _wifiObject.ipAddress.toString() : "ip";
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on:' + ipAddress),
        ),
      ),
    );
  }
}
37
likes
0
pub points
70%
popularity

Publisher

unverified uploader

Wifi info wrapper android plugin,plugin serves as a bridge from flutter currently to android native code to retrieve Network info from example device Ip and Mac Address. IOS implemetation will be realeased soon.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on wifi_info_plugin