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
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 20. Create a Navigation State Object Next episode: 22. Support Web Url

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

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,
        ));