ConnectivityStateObserver class

Observes the device's network connectivity state.

This class listens to changes from connectivity_plus and notifies the provided onNetworkEvent callback whenever the device connects to or disconnects from the internet.

Constructors

ConnectivityStateObserver({ConnectivityEventCallback? onNetworkEvent})
Creates a ConnectivityStateObserver and starts listening for connectivity changes.

Properties

hashCode int
The hash code for this object.
no setterinherited
onNetworkEvent ConnectivityEventCallback?
Callback that is triggered when the NetworkState changes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes the observer and cancels the connectivity subscription.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited