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

Discover network connectivity changes throught the app with your own custom no internet widget.

example/lib/main.dart

import 'package:connectivity_watcher/NetworkService/Connectivity_Watcher.dart';
import 'package:example/NoInternet.dart';
import 'package:flutter/material.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        navigatorKey: ConnectivityWatcher.contextKey,
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: RedScreen());
  }
}

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

  @override
  State<RedScreen> createState() => _RedScreenState();
}

class _RedScreenState extends State<RedScreen> {
  @override
  void initState() {
    // TODO: implement initState
    ConnectivityWatcher.shared.setup(widgetForNoInternet: CustomNoInternet());
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.red,
    );
  }
}
34
likes
0
pub points
65%
popularity

Publisher

verified publisherthezerone.com

Discover network connectivity changes throught the app with your own custom no internet widget.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, internet_connection_checker

More

Packages that depend on connectivity_watcher