Go<T> class

A utility class to handle navigation operations.

This class provides various methods for navigation, making it easier to manage navigation with both BuildContext and GlobalKey<NavigatorState>.

Constructors

Go(BuildContext? context)
Constructor for Go when using BuildContext.
Go.withKey(GlobalKey<NavigatorState>? navigatorKey)
Constructor for Go when using GlobalKey<NavigatorState>.

Properties

context BuildContext?
The BuildContext used for navigation.
final
currentArgs Map<String, dynamic>?
Retrieves the arguments passed to the current route.
no setter
hashCode int
The hash code for this object.
no setterinherited
The GlobalKey<NavigatorState> used for navigation.
final
The GoNavigatorObserver used to track the top route in the navigation stack.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

backWithData(T data) → void
Navigates back to the previous screen with provided data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTapRecognizeGesture({String? routeName, Map<String, dynamic>? args}) TapGestureRecognizer
Creates a TapGestureRecognizer that navigates to a specified route when tapped.
pop() → void
Pops the current route off the navigation stack.
popUntilNamedRoute(String routeName) → void
Pops until a specific route is reached.
replaceWithNamedRoute(String routeName, {Map<String, dynamic>? args}) → void
Replaces the current route with a named route.
to(String routeName, {Map<String, dynamic>? args}) → void
Navigates to the specified route.
toAndClearAll(String routeName, {Map<String, dynamic>? args}) → void
Navigates to the specified route and clears all previous routes.
toAndClearAllNamedRoute(String routeName, {Map<String, dynamic>? args}) → void
Navigates to a new route and removes all previous routes from the stack.
toAndExpectData(String routeName, {Map<String, dynamic>? args}) Future<T?>
Navigates to the specified route and expects to receive data back.
toString() String
A string representation of this object.
inherited

Operators

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