Flows class

Flows - Dependency Injection and Navigation

Main features:

  • Dependency Injection with Flows.put/Flows.find
  • Route management with Flows.to/Flows.toNamed
  • Snackbar and Dialog utilities
  • Context access

Constructors

Flows()

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

arguments → dynamic
Get current arguments from route settings
no setter
context BuildContext?
Get current context from navigator
no setter
isDialogOpen bool
Check if a dialog is currently open
no setter
no setter
no setter

Static Methods

back<T>([T? result]) → void
Go back
backUntil(String routeName) → void
Go back until a route
closeAllDialogs() → void
Close all open dialogs
closeAllOverlays() → void
Close all overlays (dialogs and snackbars)
closeAllSnackbars() → void
Close all open snackbars
defaultDialog<T>({String title = "Alert", EdgeInsetsGeometry? titlePadding, TextStyle? titleStyle, Widget? content, EdgeInsetsGeometry? contentPadding, VoidCallback? onConfirm, VoidCallback? onCancel, VoidCallback? onCustom, Color? cancelTextColor, Color? confirmTextColor, String? textConfirm, String? textCancel, String? textCustom, Widget? confirm, Widget? cancel, Widget? custom, Color? backgroundColor, bool barrierDismissible = true, Color? buttonColor, String middleText = "\n", TextStyle? middleTextStyle, double radius = 20.0, List<Widget>? actions}) Future<T?>
Show a default dialog
delete<S>({String? tag, bool force = false}) bool
Delete a dependency
dialog<T>(Widget widget, {bool barrierDismissible = true, Color? barrierColor, bool useSafeArea = true, Object? arguments, Duration? transitionDuration, Curve? transitionCurve, String? name}) Future<T?>
Show a dialog
find<S>({String? tag}) → S
Find a dependency
isRegistered<T>({String? tag}) bool
Check if a dependency is registered
lazyPut<S>(S builder(), {String? tag, bool permanent = false}) → S
Lazy registration
off<T>(Widget page, {FlowsBinding? binding}) Future<T?>
Replace current route
offAll(Widget page, {FlowsBinding? binding}) → void
Remove all routes until the first one
offAllNamed(String routeName, {Object? arguments}) → void
Remove all routes until the first one with named route
offNamed<T>(String routeName, {Object? arguments}) Future<T?>
Replace current route with named route
put<S>(S dependency, {String? tag, bool permanent = false}) → S
Register a dependency
rawSnackbar({String? title, String? message, Widget? titleText, Widget? messageText, Widget? icon, bool shouldIconPulse = true, double? maxWidth, EdgeInsets margin = const EdgeInsets.all(0.0), EdgeInsets padding = const EdgeInsets.all(16), double borderRadius = 0.0, Color? borderColor, double borderWidth = 1.0, Color backgroundColor = const Color(0xFF303030), Color? leftBarIndicatorColor, List<BoxShadow>? boxShadows, Gradient? backgroundGradient, Widget? mainButton, OnTap? onTap, Duration? duration = const Duration(seconds: 3), bool isDismissible = true, bool showProgressIndicator = false, AnimationController? progressIndicatorController, Color? progressIndicatorBackgroundColor, Animation<Color>? progressIndicatorValueColor, SnackPosition snackPosition = SnackPosition.bottom, SnackStyle snackStyle = SnackStyle.floating, Curve forwardAnimationCurve = Curves.easeOutCirc, Curve reverseAnimationCurve = Curves.easeOutCirc, Duration animationDuration = const Duration(seconds: 1), SnackbarStatusCallback? snackbarStatus, double barBlur = 0.0, double overlayBlur = 0.0, Color? overlayColor, Form? userInputForm}) SnackbarController
Show a raw snackbar
refresh() → void
Trigger a rebuild of reactive widgets This is useful when you need to force a UI update
reset() → void
Reset all dependencies (useful for testing)
snackbar(String title, String message, {Color? colorText, Duration? duration = const Duration(seconds: 3), bool instantInit = true, SnackPosition? snackPosition = SnackPosition.top, Widget? titleText, Widget? messageText, Widget? icon, bool? shouldIconPulse, double? maxWidth, EdgeInsets? margin, EdgeInsets? padding, double? borderRadius, Color? borderColor, double? borderWidth, Color? backgroundColor, Color? leftBarIndicatorColor, List<BoxShadow>? boxShadows, Gradient? backgroundGradient, Widget? mainButton, OnTap? onTap, OnHover? onHover, bool? isDismissible, bool? showProgressIndicator, AnimationController? progressIndicatorController, Color? progressIndicatorBackgroundColor, Animation<Color>? progressIndicatorValueColor, SnackStyle? snackStyle, Curve? forwardAnimationCurve, Curve? reverseAnimationCurve, Duration? animationDuration, double? barBlur, double? overlayBlur, SnackbarStatusCallback? snackbarStatus, Color? overlayColor, Form? userInputForm}) SnackbarController
Show a snackbar
to<T>(Widget page, {FlowsBinding? binding}) Future<T?>
Navigate to a page
toNamed<T>(String routeName, {Object? arguments}) Future<T?>
Navigate to a named route