SnackbarService class

A service that allows the user to show the snackbar from a ViewModel

Constructors

SnackbarService()

Properties

hashCode int
The hash code for this object.
no setterinherited
isOpen bool?
Checks if there is a snackbar open
no setter
isSnackbarOpen bool
Check if snackbar is open
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

closeSnackbar() Future<void>
Close the current snack bar
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerCustomMainButtonBuilder({dynamic variant, Widget builder(String?, Function?)?}) → void
Registers a builder that will be used when showing a matching variant value. The builder function takes in a String to display as the title and a Function to be used to the onTap callback
registerCustomSnackbarConfig({required dynamic variant, SnackbarConfig? config, SnackbarConfig configBuilder()?}) → void
Saves the config against the value of variant. A configBuilder can also be supplied which will be chosen over the config for the same variant when requested.
registerSnackbarConfig(SnackbarConfig config) → void
Saves the config to be used for the showSnackbar function
showCustomSnackBar({required String message, TextStyle? messageTextStyle, required dynamic variant, String? title, TextStyle? titleTextStyle, String? mainButtonTitle, ButtonStyle? mainButtonStyle, void onMainButtonTapped()?, Function? onTap, Duration? duration}) Future?
showSnackbar({String title = '', required String message, dynamic onTap(dynamic)?, Duration? duration, String? mainButtonTitle, void onMainButtonTapped()?}) → void
Shows a snack bar with the details passed in
toString() String
A string representation of this object.
inherited

Operators

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