wifi_ip_details 0.0.1 copy "wifi_ip_details: ^0.0.1" to clipboard
wifi_ip_details: ^0.0.1 copied to clipboard

outdated

A Flutter package for getting WIFI Details.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:wifi_ip_details/wifi_ip_details.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'WIFI IP Details',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'WIFI Ip Details'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  IPDetails? _ipDetails;
  bool isLoading = false;

  Future<void> _getWifiDetails() async {
    isLoading = true;
    _ipDetails = null;
    setState(() {});
    try {
      _ipDetails = await WifiIPDetails.getMyWIFIDetails();
    } catch (e) {}
    isLoading = false;
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            if (isLoading)
              const CircularProgressIndicator()
            else
              SelectableText(
                "${_ipDetails ?? 'No Data Available'}",
              ),
            ElevatedButton(
              onPressed: () {
                _getWifiDetails();
              },
              child: const Text(
                "Get IP Details",
              ),
            )
          ],
        ),
      ),
    );
  }
}
7
likes
0
points
65
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for getting WIFI Details.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http

More

Packages that depend on wifi_ip_details