Flutter Navigator 2.0

Nov 8 2022 Dart 2.17.3, Flutter 3.0.2, Android Studio 2020.3

Part 4: Deep Links & Web Urls

21. Create a Route Information Parser

Episode complete

Play next episode

Next
Save for later
About this episode
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 20. Create a Navigation State Object Next episode: 22. Support Web Url

This video Create a Route Information Parser was last updated on Nov 8 2022

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

Episode - 21 Create a Route Information Parser

Now that our Navigation state is ready let us parse the infromation that we get from our navigation. We are going to use the RouteInformationParser for this. In the Router directory create a new file called as book_router_parser.dart and in this file create a BookRouterParser class which extends RouteInformationParser with our AppLink Type like this.

class BookRouterParser extends RouteInformationParser<AppLink>{}
  @override
  Future<AppLink> parseRouteInformation(
      RouteInformation routeInformation) async {
    final link = AppLink.fromLocation(routeInformation.location);
    print(link.location);
    return link;
  }
  @override
  RouteInformation restoreRouteInformation(AppLink appLink) {
    final location = appLink.toLocation();

    return RouteInformation(location: location);
  }
final bookRouterParser = BookRouterParser();
MaterialApp.router(
          routeInformationParser: bookRouteParser,
          backButtonDispatcher: RootBackButtonDispatcher(),
          routerDelegate: _bookRouterDelegate,
        ));