connection_notifier
4.1.1, released 2 months ago by an unverified publisher
Notifies users about internet connection status and provides tools to track connectivity.
What it does
It listens to internet connectivity changes and displays global or local overlay notifications when the connection is lost or restored. It also offers programmatic tools like synchronous and asynchronous status getters and connection toggler widgets.
AI-written summary of version 4.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to automatically show a banner or overlay when the user goes offline or comes back online.
- You want support for modern routing solutions like GoRouter or AutoRoute alongside classic navigation.
- You need an easy way to check connectivity programmatically or toggle widgets based on connection state.
Skip it when
- You require complex offline-first data synchronization and queue management rather than simple connection notification.
- You do not want global overlay banners displayed over your app.
Strengths
- Works with both Navigator 1.0 and Navigator 2.0 routing solutions like GoRouter and AutoRoute.
- Fully supports all Flutter platforms including iOS, Android, Web, macOS, Windows, and Linux.
- Provides injectable connectivity handlers for custom connection source implementation.
Weaknesses
- Primarily focused on UI notification and basic status checking rather than advanced offline data management.
- Relies on overlay mechanisms which might overlap with custom app top/bottom bars if not configured carefully.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Requires calling `await ConnectionNotifierTools.initialize();` in `main()` before `runApp()`.
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await ConnectionNotifierTools.initialize();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GlobalConnectionNotifier(
child: MaterialApp(
title: 'My App',
home: const MyHomePage(),
),
);
}
}Alternatives
Packages that do the same job and could replace connection_notifier.
- observe_internet_connectivity
Observe active internet connectivity changes via customizable strategies and stream/widget listeners.
68Compare - simple_connection_checker
Check device internet connection and listen to status changes.
53Compare - internet_connectivity_checker
Manage widgets dynamically based on actual internet access.
47Compare - check_vpn_connection
Check whether a VPN connection is active on your device.
46Compare
Works with
Packages commonly used together with connection_notifier: ones it builds on, ones built on it, and its own family.