ConnectivitySnackbar class abstract final

Helper class for showing connectivity-related SnackBars.

Call ConnectivitySnackbar.setup once in your app (in a StatefulWidget's initState or in a top-level widget that has a valid BuildContext).

It auto-listens to SmartConnectivityMonitor and shows snackbars on changes.

@override
void initState() {
  super.initState();
  ConnectivitySnackbar.setup(context: context);
}

@override
void dispose() {
  ConnectivitySnackbar.teardown();
  super.dispose();
}

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Methods

setup({required BuildContext context, String offlineMessage = 'No internet connection', String onlineMessage = 'Back online', String? slowMessage, Duration duration = const Duration(seconds: 3)}) → void
Wire up automatic snackbars.
show({required BuildContext context, required String message, Color backgroundColor = Colors.black87, IconData icon = Icons.info_outline, Duration duration = const Duration(seconds: 3)}) → void
Show a one-off connectivity snackbar manually.
teardown() → void
Remove listeners set up by setup. Call in dispose().