TfkToast class
====================================================== TfkToast
A simple global toast system for Flutter.
This package shows non-intrusive toast messages anywhere in your app, even during navigation.
It works with:
- MaterialApp
- GoRouter
- Navigator 1.0 / 2.0
HOW IT WORKS
Priority for showing toast:
- BuildContext (best and most reliable)
- Global navigatorKey (fallback)
-
Safe fail (no crash)
Constructors
- TfkToast()
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 Properties
-
Optional app-provided navigator key (GoRouter / MaterialApp)
getter/setter pair
-
Global navigator key fallback (optional).
Used when BuildContext is not available.
final
Static Methods
-
showToast(
String message, {BuildContext? context, ToastType type = ToastType.info, ToastPosition position = ToastPosition.top, Duration duration = const Duration(seconds: 2), String? title, bool showCloseIcon = true, ToastAnimation animation = ToastAnimation.none, TextStyle? messageStyle, TextStyle? titleStyle, EdgeInsetsGeometry? padding, double borderRadius = 8.0, double elevation = 0.0, Widget? icon, Color? backgroundColor, VoidCallback? onTap, double? progress, bool showIndicator = false}) → void - ====================================================== SHOW TOAST