router_management 2.3.2 copy "router_management: ^2.3.2" to clipboard
router_management: ^2.3.2 copied to clipboard

outdated

A plugin that wraps the Navigator 2.0 with a syntax sugar for Flutter Developers

example/lib/main.dart

import 'package:example/page_validators/profile_validator.dart';
import 'package:example/ui/home_screen.dart';
import 'package:example/ui/not_found.dart';
import 'package:example/ui/profile_screen.dart';
import 'package:example/ui/splash_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:router_management/router_management.dart';

void main() {
  runApp(
    NavigationRouter(
      builder: buildRouter, // The PageWidget that builds a Router
      pages: [
        NavigationPage(
          path: SplashScreen.path,
          builder: () => const SplashScreen(),
          name: SplashScreen.name,
        ),
        NavigationPage(
          path: HomeScreen.path,
          builder: () => const HomeScreen(),
          name: HomeScreen.name,
        ),
        NavigationPage(
            path: ProfileScreen.path,
            builder: () => const ProfileScreen(),
            name: ProfileScreen.name,
            validators: const [ProfileValidator()]),
      ], // The pages
      // The initial page's path. Defaults to "/"
      initialPage: SplashScreen.path,
      unknownPage: NavigationPage(
        path: NotFound.path,
        builder: () => const NotFound(),
        name: NotFound.name,
      ), // A page that is built when an unknown path is passed
    ),
  );
}

Widget buildRouter(
    RouteInformationProvider routeInformationProvider,
    RouteInformationParser<Object> routeInformationParser,
    RouterDelegate<Object> routerDelegate) {
  return MaterialApp.router(
    routeInformationProvider: routeInformationProvider,
    routeInformationParser: routeInformationParser,
    routerDelegate: routerDelegate,
    title: 'Router Management Example',
    localizationsDelegates: GlobalMaterialLocalizations.delegates,
  );
}
9
likes
0
pub points
57%
popularity

Publisher

verified publishervegasdevelopments.com

A plugin that wraps the Navigator 2.0 with a syntax sugar for Flutter Developers

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, url_strategy

More

Packages that depend on router_management