CustomSnackBar class

Create a SnackBar directly from ScaffoldMessenger.

As earlier way of showing SnackBar from ScaffoldState (or scaffoldKey) is deprecated, you will have to wrap your Scaffolds with a ScaffoldMessenger to show a SnackBar.

For more information, see the documentation of ScaffoldMessenger.

Constructors

CustomSnackBar()
Create a SnackBar directly from ScaffoldMessenger.

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

hideAll() → void
Immediately hides the SnackBar
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showErrorSnackBar(String msg, {Color? backgroundColor, Duration? duration}) → void
Shows a SnackBar with given error msg
showLoadingSnackBar({Color? backgroundColor, Duration? duration}) → void
Show a Loading SnackBar for 1 minute
showRawSnackBar(SnackBar snackBar) → void
Show the given snackBar
showSnackBar({required String text, TextStyle? textStyle, Duration? duration, Color? color, SnackBarAction? action, SnackBarBehavior behavior = SnackBarBehavior.fixed, Animation<double>? animation, VoidCallback? onVisible}) → void
Show a SnackBar with text (maximum 2 lines) and color in the background. It will stayed for duration and automatically hides.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

customTheme CustomSnackBarTheme
Additional theme information for CustomSnackBar
getter/setter pair
rootScaffoldMessengerKey GlobalKey<ScaffoldMessengerState>
Use this Key in the MaterialApp. This will automatically find ScaffoldMessenger in the nearest Scaffold.
final