You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any of these **can be null** if you try to open a deep link without specifing them **or if they fail to parse** (e.g. `falseee` as
136
-
a bool outputs `null`).
135
+
Any of these **can be null** if you try to open a deep link without specifying them **or if they fail to parse** (e.g. `false` as a bool outputs `null`).
137
136
138
137
If you create a Route that takes an argument of a different type and it has a deep link, Nuvigator's code generation tool will issue
139
138
a warning about it. This is because, when decoding something that is not declared as one of these types, the result **will be a String**.
@@ -164,10 +163,10 @@ annotation.
164
163
165
164
Example:
166
165
```dart
167
-
@NuRouter()
168
-
class MyCustomRouter extends Router {
166
+
@nuRouter
167
+
class MyCustomRouter extends NuRouter {
169
168
170
-
@NuRouter()
169
+
@nuRouter
171
170
MyOtherRouter myOtherRouter = MyOtherRouter();
172
171
173
172
@override
@@ -179,36 +178,36 @@ class MyCustomRouter extends Router {
179
178
180
179
### Router Options
181
180
182
-
When extending from the `Router` you can override the following properties to add custom behaviors to your routes:
181
+
When extending from the `NuRouter` you can override the following properties to add custom behaviors to your routes:
183
182
184
183
-`deepLinkPrefix`:
185
184
A `Future<String>`, that is used as prefix for the deep links declared on each route, and also for the grouped routers.
186
185
187
186
-`screensWrapper`:
188
187
A function to wrap each route presented by this router. Should return a new Widget that wraps this child Widget.
189
-
The Wrapper is applied to all Screens in this Router. This function runs one time for each screen, and not one
190
-
time for the entire Router.
188
+
The Wrapper is applied to all Screens in this NuRouter. This function runs one time for each screen, and not one
189
+
time for the entire NuRouter.
191
190
192
191
-`routers`
193
-
Sub-Routers grouped into this Router.
192
+
Sub-Routers grouped into this NuRouter.
194
193
195
194
## Code Generators
196
195
197
196
You may have noticed in the examples above that we have methods that will be created by the Nuvigator generator. So while
198
197
they don't exists you can just make they return `null` or leave un-implemented.
199
198
200
-
Before running the generator we recommend being sure that each Router is in a separated file, and also make sure that you
199
+
Before running the generator we recommend being sure that each NuRouter is in a separated file, and also make sure that you
201
200
have added the `part 'my_custom_router.g.dart';` directive and the required imports (`package:nuvigator/nuvigator.dart` and `package:flutter/widgets.dart`) in your router file.
202
201
203
202
After running the generator (`flutter pub run build_runner build --delete-conflicting-outputs`), you should notice that
204
203
each router file will have its `part-of` file created. Now you can complete the `screensMap` and `routersList` functions
205
204
with the generated: `_$myScreensMap(this);` and `_$samplesRoutersList(this);`. Generated code usually follows this pattern
206
-
of stripping out the `Router` part of your Router class and using the rest of the name for generated code.
205
+
of stripping out the `NuRouter` part of your NuRouter class and using the rest of the name for generated code.
207
206
208
207
Generated code includes the following features:
209
208
210
209
- Routes Enum-like class
211
-
- Navigation extension methods to Router
210
+
- Navigation extension methods to NuRouter
212
211
- Typed Arguments classes
213
212
- Implementation Methods
214
213
@@ -256,7 +255,7 @@ Nested flows (declared with nested Nuvigators) will also have their generated Na
256
255
in the parent Navigation. The same applies for Grouped Routers. Usage eg:
257
256
258
257
```dart
259
-
final router = Router.of<SamplesRouter>(context);
258
+
final router = NuRouter.of<SamplesRouter>(context);
Copy file name to clipboardExpand all lines: pubspec.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
name: nuvigator
2
2
description: A powerful and strongly typed routing abstraction over Flutter navigator, providing some new features and an easy way to define routers with code generation.
0 commit comments