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

A robust Flutter plugin for monitoring network connectivity changes with support for WiFi, Mobile, Ethernet, VPN, and Bluetooth connections on Android and iOS.

0.0.1 #

Initial Release #

Features

  • ✅ Real-time network connectivity monitoring via streams
  • ✅ One-time connectivity checks
  • ✅ Support for multiple connection types:
    • WiFi
    • Mobile/Cellular
    • Ethernet
    • VPN
    • Bluetooth
    • Other/Unknown
  • ✅ Cross-platform support (Android & iOS)
  • ✅ Null-safe API with strong typing
  • ✅ Comprehensive error handling

Android Implementation

  • ✅ Uses ConnectivityManager and NetworkCallback for modern Android (API 24+)
  • ✅ Fallback to BroadcastReceiver for older Android versions
  • ✅ Proper lifecycle management to prevent memory leaks
  • ✅ Thread-safe implementation with Handler for UI updates
  • ✅ Handles edge cases (airplane mode, network switching, etc.)

iOS Implementation

  • ✅ Uses NWPathMonitor from Network framework (iOS 12+)
  • ✅ Fallback to SCNetworkReachability for iOS < 12
  • ✅ Proper cleanup to prevent memory leaks
  • ✅ Main thread dispatch for stream events

API

  • NetworkWatcher.instance.checkConnectivity() - Check current connectivity
  • NetworkWatcher.instance.onConnectivityChanged - Stream of connectivity changes
  • ConnectivityResult class with convenience getters:
    • isConnected - Whether any connection exists
    • isWifi - Connected to WiFi
    • isMobile - Connected to mobile data
    • isEthernet - Connected to ethernet
    • isVpn - Connected via VPN
    • isBluetooth - Connected via bluetooth
  • ConnectivityType enum for type-safe connection types

Testing

  • ✅ Comprehensive unit tests
  • ✅ Platform channel mock testing
  • ✅ Stream functionality tests
  • ✅ Edge case and error handling tests

Documentation

  • ✅ Comprehensive README with examples
  • ✅ API documentation
  • ✅ Example app demonstrating all features
  • ✅ Platform-specific setup instructions
  • ✅ Troubleshooting guide

Example App

  • ✅ Real-time connectivity monitoring
  • ✅ Connection history tracking
  • ✅ Visual status indicators
  • ✅ Start/stop monitoring controls
  • ✅ Material Design 3 UI
0
likes
160
points
3
downloads

Publisher

verified publishersyedbipul.me

Weekly Downloads

A robust Flutter plugin for monitoring network connectivity changes with support for WiFi, Mobile, Ethernet, VPN, and Bluetooth connections on Android and iOS.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on network_watcher

Packages that implement network_watcher