flutter_router 1.2.0 copy "flutter_router: ^1.2.0" to clipboard
flutter_router: ^1.2.0 copied to clipboard

Flutter routing library that adds flexible routing options like parameters and clear route definitions

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_router/flutter_router.dart' as FRouter;

void main() => runApp(MaterialApp(
  onGenerateRoute: FRouter.Router({
    '/accounts/{id}': (context, match, settings) => Account(match!.parameters['id']!),
    '/': (context, match, settings) => Index(),
  }).get,
));

/*void main() => runApp(CupertinoApp(
  onGenerateRoute: CupertinoRouter({
    '/accounts/{id}': (context, match) => Account(match.parameters['id']),
    '/': (context, match) => Index(),
  }).get,
));*/

class Account extends StatelessWidget {
  final String id;

  Account(this.id);

  @override
  Widget build(BuildContext context) {
    return Scaffold(body: Center(child: Text(this.id)));
  }
}

class Index extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(body: Center(child: Text('Index')));
  }
}
copied to clipboard
5
likes
140
points
266
downloads

Publisher

verified publisherelita.si

Weekly Downloads

2024.09.23 - 2025.04.07

Flutter routing library that adds flexible routing options like parameters and clear route definitions

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, uri

More

Packages that depend on flutter_router