ApiSuccessNavigation class

Describes what navigation action to take after a successful API response.

// Pop back on success
ApiSuccessNavigation.pop()

// Push a named route on success
ApiSuccessNavigation.push('/home')

// Replace current screen on success
ApiSuccessNavigation.replace('/dashboard')

// Clear stack and push on success
ApiSuccessNavigation.offAll('/login')

// Conditional navigation
ApiSuccessNavigation(
  action: NavigationAction.pop,
  condition: (body) => body['verified'] == true,
)

Constructors

ApiSuccessNavigation({NavigationAction action = NavigationAction.none, String? routeName, Object? arguments, dynamic widgetBuilder()?, bool condition(dynamic responseBody)?})
Creates an ApiSuccessNavigation with full control.
const
ApiSuccessNavigation.offAll(String route, {Object? args})
Calls Get.offAllNamed(route) after a successful response.
const
ApiSuccessNavigation.pop()
Calls Get.back() after a successful response.
const
ApiSuccessNavigation.push(String route, {Object? args})
Calls Get.toNamed(route) after a successful response.
const
ApiSuccessNavigation.replace(String route, {Object? args})
Calls Get.offNamed(route) after a successful response.
const

Properties

action → NavigationAction
The navigation action to perform.
final
arguments → Object?
Arguments forwarded to the new route via Get.toNamed(arguments: ...).
final
condition → bool Function(dynamic responseBody)?
Optional guard: navigation only happens when this returns true.
final
hashCode → int
The hash code for this object.
no setterinherited
routeName → String?
Named route for NavigationAction.pushNamed, NavigationAction.pushReplacement, NavigationAction.pushAndRemoveUntil, and NavigationAction.offAll.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
widgetBuilder → dynamic Function()?
Widget builder used with NavigationAction.offAll when no routeName is provided.
final

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