observe_internet_connectivity
1.0.3, released 2 months ago by an unverified publisher
Observe active internet connectivity changes via customizable strategies and stream/widget listeners.
What it does
Checks for an actual internet connection by pinging addresses using sockets rather than just checking if WiFi or mobile data is turned on. Provides stream controllers, widget builders, and widget listeners to react to connectivity changes.
AI-written summary of version 1.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to verify actual internet reachability rather than just interface status
- You want to reactively update widgets or retry network requests when the connection is restored
Skip it when
- You only need to know the raw network interface type without actual internet reachability checks
Strengths
- Provides multiple built-in observing strategies (default, first-connected, first-disconnected, duration-based)
- Includes ready-to-use widgets like InternetConnectivityListener and InternetConnectivityBuilder
- Supports custom observing strategies
Weaknesses
- Relies on socket pinging which might be blocked by certain firewalls or captive portals
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
not documented
final hasInternet = await InternetConnectivity().hasInternetConnection;
if (hasInternet) {
// Connected
} else {
// Offline
}Alternatives
Packages that do the same job and could replace observe_internet_connectivity.
- connectivity_plus
Pick connectivity_plus if you need raw network interface status (wifi, cellular, ethernet) rather than active internet reachability verification.
97Compare