wifi_info_plus 0.0.2 copy "wifi_info_plus: ^0.0.2" to clipboard
wifi_info_plus: ^0.0.2 copied to clipboard

A Flutter plugin to get WiFi SSID and BSSID on Android/iOS.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  Map<String, String>? wifiInfo;

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

  Future<void> initPlatformState() async {
    String platformVersion = 'Unknown';
    Map<String, String>? info;

    try {
      info = await WifiInfo.getWifiInfo();
      platformVersion = 'iOS Wi-Fi Info';
    } on PlatformException catch (e) {
      platformVersion = 'Failed to get Wi-Fi info: ${e.message}';
    }

    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
      wifiInfo = info;
    });
  }


  @override
  Widget build(BuildContext context) {
    final ssid = wifiInfo?['ssid'] ?? '-';
    final bssid = wifiInfo?['bssid'] ?? '-';

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('WiFi Info Plugin Example'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Status: $_platformVersion\n'),
              Text('SSID: $ssid'),
              Text('BSSID: $bssid'),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
135
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to get WiFi SSID and BSSID on Android/iOS.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on wifi_info_plus

Packages that implement wifi_info_plus