Getting Started
VxNavigator
VxNavigator is based on navigator 2.0 for Flutter apps. It provides many useful methods and send params easily.
Getting started
Import routing config in the main.dart file and configure routing
Initialize routing management
note
The routes field:
key is url
Value is the function to return to the page, uri is the route parameter, and params is the page parameter, which is passed according to the parameter type.
Guarded routes
Navigate without a context
main.dart
my_widget.dart
Methods
tip
VxNavigator.of(context)
can be used as context.vxNav
or vice-versa.
1.push(Uri uri, {dynamic params})
Route jump method, support routing parameter transfer and custom data type transfer parameter
2.replace(Uri uri, {dynamic params})
Replace the current route.
3.pop()
Return to the previous page, if you want to return the reference, please use returnAndPush
4.clearAndPush(Uri uri, {dynamic params})
Clear the routing stack and reset the home page, such as a login scenario
5.pushAll(List<Uri> uris, {List<dynamic> params})
Set multiple uris at once and jump to the last route
6.clearAndPushAll(List<Uri> uris, {List<dynamic> params})
Clear the routing stack and jump (set multiple uri)
7.waitAndPush(Uri uri, {dynamic params})
Jump to wait for the result
8.returnAndPush(dynamic value)
Jump to return result
9.popToRoot()
The routing stack only keeps the home page
10.removeUri(Uri uri)
Delete the specified route
11.removeLastUri()
Delete the route at the top of the stack
Custom Animation
Url Strategy
Page monitoring
There are two ways to monitor changes in the routing stack:
Second way (Navigation observers)
VxNavigator so far
- Upgrade Flutter v2 to support null safety
- Url strategy
- Custom animation routing
- Regex support
- [] Nested routing