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')));
  }
}
5
likes
140
points
169
downloads

Publisher

verified publisherelita.si

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, uri

More

Packages that depend on flutter_router