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
Copy file name to clipboardExpand all lines: doc/docs/flutter_modular/start.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,7 @@ The main Widget's function is to instantiate the MaterialApp or CupertinoApp.
144
144
145
145
In these main Widgets it's also necessary to set the custom route system. For this next snippet we'll use **MaterialApp**, but the process is exactly the same for CupertinoApp.
@@ -185,6 +185,20 @@ class HomePage extends StatelessWidget {
185
185
}
186
186
```
187
187
188
-
Here we create a Widget called **AppWidget** containing an instance of **MaterialApp**. Note that in the end, we call **.modular()** method that was added to **MaterialApp** through an extension.
188
+
Here we create a Widget called **AppWidget** containing an instance of **MaterialApp.router**.
189
+
190
+
191
+
## Support methods
192
+
193
+
Navigator 2.0 made Flutter's routing system more dynamic, but some information, previously passed in MaterialApp or CupertinoApp, has been removed, and it will be necessary to configure it using Modular's own support methods.
194
+
195
+
```dart
196
+
Modular.setNavigatorKey(myNavigatorKey);
197
+
198
+
Modular.setObservers([myObserver]);
199
+
200
+
Modular.setInitialRoute('/home');
201
+
```
202
+
189
203
190
204
That's enough to run a Modular app. In the next steps let's explore navigation.
0 commit comments