SnackBarService class

A service to show SnackBars.

Usage: MaterialApp( scaffoldMessengerKey: ref.watch(snackBarProvider).key, ... )

ref.read(snackBarProvider).showMessage('Hello World');

Constructors

SnackBarService()

Properties

hashCode int
The hash code for this object.
no setterinherited
hideCurrent bool
Whether to hide the current SnackBar before showing a new one.
getter/setter pair
key GlobalKey<ScaffoldMessengerState>
The GlobalKey to access the ScaffoldMessengerState.
no setter
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
setKey(GlobalKey<ScaffoldMessengerState> key) → void
Set the GlobalKey to access the ScaffoldMessengerState. Use this if you already have a GlobalKey for ScaffoldMessengerState.
showMessage(String message, {SnackBarAction? action, bool? hideCurrent}) → void
Shows a SnackBar with the given message. Override this method to customize the SnackBar.
toString() String
A string representation of this object.
inherited

Operators

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