SmartApiToast class
A single-file, dependency-free toast/snackbar overlay for
smart_api.
Because the whole point of SmartApiHooks.showMessage is to avoid
forcing any particular UI package on you, this widget is entirely
optional — wire it up like so:
SmartApiHooks.showMessage = (msg, {type}) => SmartApiToast.show(
navigatorKey.currentContext!,
msg,
style: SmartApiToast.styleForMsgType(type),
);
Only one toast is shown at a time — calling show again replaces whatever is currently on screen.
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
-
hide(
) → void - Removes any toast currently on screen, if one is showing.
-
show(
BuildContext context, String message, {SmartApiToastStyle style = SmartApiToastStyle.info, Duration duration = const Duration(milliseconds: 3500)}) → void -
Shows
messagein the givenstyle(default SmartApiToastStyle.info) forduration(default 3.5 seconds). -
styleForMsgType(
SmartApiMsgType? type) → SmartApiToastStyle - Maps a SmartApiMsgType (from SmartApiHooks.showMessage) to a sensible default SmartApiToastStyle.