NetworkAwareNavigatorObserver class

A custom NavigatorObserver that displays a widget or overlay when the device's network connection changes.

This observer listens to changes in the network state using NetworkMonitor and displays a custom widget or overlay when the connection is lost. It supports two modes of operation, controlled by the errorType property: displaying an overlay or displaying a widget.

Inheritance

Constructors

NetworkAwareNavigatorObserver({Widget? networkStatusScreen, ErrorType errorType = ErrorType.overlay})
Factory constructor for creating the singleton instance of NetworkAwareNavigatorObserver.
factory

Properties

errorType ErrorType
The type of error display to use.
final
hashCode int
The hash code for this object.
no setterinherited
The navigator that the observer is observing, if any.
no setterinherited
networkStatusScreen Widget?
The widget to display when the network connection is lost and errorType is ErrorType.widget.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

didChangeTop(Route topRoute, Route? previousTopRoute) → void
The top most route has changed.
inherited
didPop(Route route, Route? previousRoute) → void
Called after a route has been popped.
override
didPush(Route route, Route? previousRoute) → void
Called after a route has been pushed.
override
didRemove(Route route, Route? previousRoute) → void
The Navigator removed route.
inherited
didReplace({Route? newRoute, Route? oldRoute}) → void
The Navigator replaced oldRoute with newRoute.
inherited
didStartUserGesture(Route route, Route? previousRoute) → void
The Navigator's routes are being moved by a user gesture.
inherited
didStopUserGesture() → void
User gesture is no longer controlling the Navigator.
inherited
dispose() → void
Disposes of the NetworkAwareNavigatorObserver.
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