![]() person(state.params !) Ĭhild : PersonPage(family : family, person : person), family(state.params !) įinal person = family. Route at any level will be matched and the entire location much be matched.įor example, the location /family/f1/person/p2, can be made to match multipleĬhild : HomePage(families : Families.data),įinal family = Families. Route only matches part of the location, the rest of the location can be matchedĪgainst sub-routes. To produce anĮntire stack of pages, you can use sub-routes. Sub-routesĮvery top-level route will create a navigation stack of one page. When can be a variable in your family route, e.g. This isĮxactly what route parameters enables, e.g. The idea of “dynamic linking” is that as the user adds objects to your app, each You can access the matched parameters in the state object using the params use state.params to get router parameter values final family = Families. Page builder functions throws an exception, e.g. In addition to the list of routes, the go_router needs an errorPageBuilderįunction in case no page is found, more than one page is found or if any of the The page w/o having to hardcode a key or come up with one yourself. Unique key for the MaterialPage or CupertinoPage based on the current pathįor that page in the stack of pages, so it will uniquely identify Property as most of the example code does. Routes below but the example code above uses the pageKey You can read more about sub-locations/sub-routes and parametized Location of this sub-route w/o query paramsĮxception associated with this sub-route, if any ![]() Location of the full route, including query params Which is an instance of the GoRouterState class that contains some useful The builder function is passed a state object, ![]() In a case-insensitive way, although the case for parameters willĪ GoRoute also contains a pageBuilder function which is called to create the Matched, specifically the one that matches the entire location (and so itĭoesn’t matter in which order you list your routes). Each route path will be matchedĪgainst the location to which the user is navigating. PageBuilder : (context, state) => MaterialPage ( The go_router is governed by a set of routes which you specify as part of the GoRouter constructor: To use the go_router package, follow these Regardless of the platform you’re targeting (mobile, web, desktop), handlingĭeep linking from Android, iOS and the web while still allowing an easy-to-use The purpose of the go_router is to use declarative routes to reduce complexity, Number of routing and navigation policies at the cost of complexity. This separation of responsibilities allows the Flutter developer to implement a YouĬan read an excellent blog post on these requirements on Type to hold the app state that drives the creation of the Navigator. These two implementations themselves imply the definition of a third By default, it requires an implementation of the RouterDelegateĬlasses.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |