no_internet_check 0.0.7 copy "no_internet_check: ^0.0.7" to clipboard
no_internet_check: ^0.0.7 copied to clipboard

outdated

Automatically show no internet screen on top of your current screen and when there is internet it automatically pop the no inter screen.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      navigatorKey: NavigationService.navigationKey, //TODO: ADD THIS LINE
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  @override
  void initState() {
    InternetChecker(); //TODO: ADD THIS LINE
    super.initState();
  }

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
14
likes
0
pub points
68%
popularity

Publisher

unverified uploader

Automatically show no internet screen on top of your current screen and when there is internet it automatically pop the no inter screen.

Homepage
Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_toastr, internet_connection_checker

More

Packages that depend on no_internet_check