Skip to main content

router_builder 3.0.2 copy "router_builder: ^3.0.2" to clipboard
router_builder: ^3.0.2 copied to clipboard

unlisted

Declarative Flutter navigation and deep link generator with typed routes.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:router_builder_example/routes.g.dart';

void main() {
  RoutesHelper.installDefaults();
  runApp(const ExampleApp());
}

/// Root widget of the example.
class ExampleApp extends StatelessWidget {
  /// Creates the example app.
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) => const MaterialApp(home: HomeScreen());
}

/// Demonstrates the generated helper at runtime.
class HomeScreen extends StatelessWidget {
  /// Creates the home screen.
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final match = RoutesHelper.resolveDeepLink(
      Uri.parse('https://example.com/items/42'),
      allowedHosts: const ['example.com'],
    );
    return Scaffold(
      appBar: AppBar(title: const Text('router_builder example')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text('Total routes: ${RoutesHelper.allRoutes.length}'),
            Text('Global routes: ${RoutesHelper.globalRoutes.length}'),
            Text('Authorized routes: ${RoutesHelper.authorizedRoutes.length}'),
            Text('Redirect routes: ${RoutesHelper.redirectRoutes.length}'),
            Text('Branches: ${RoutesHelper.allBranches().length}'),
            Text(
              'Deep link -> ${match?.route.name ?? 'none'} '
              '(id=${match?.args.id})',
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
0
points
246
downloads

Documentation

Documentation

Publisher

verified publishertomars.tech

Weekly Downloads

Declarative Flutter navigation and deep link generator with typed routes.

Repository (GitHub)
View/report issues

Topics

#flutter #navigation #routing #code-generation #deep-linking

License

unknown (license)

Dependencies

analyzer, build, dart_helper_utils, dart_style, equatable, flutter, glob, source_gen

More

Packages that depend on router_builder