Skip to content

hasanm08/flow

Repository files navigation

Flow Routing

The next-generation Flutter router — typed, fast, and built from first principles. image

Published on pub.dev as flow_routing.

version flutter

context.flow(Routes.home);
context.flow(Routes.user(id: 42));
context.flow(Routes.about, push: true);
context.pop();

Routes.user(id: 5).location; // → "/users/5"

Why Flow?

Feature Flow GoRouter AutoRoute
Typed routes ✅ First-class ⚠️ Codegen ✅ Codegen required
No code generation
Separated nav stacks ⚠️
Pipeline guards ⚠️
Web-first URLs ⚠️
Optional middleware

Features

  • Instance routesRoutes.user(id: 42) not '/users/42'
  • Unified navigationcontext.flow() for go and push; context.pop() to go back
  • Reverse routing — URLs generated automatically via .location
  • Pipeline guards — composable auth, roles, async validation
  • Middleware — logging, analytics, localization hooks
  • Separated stacks — declarative flow vs overlay flow(..., push: true)
  • Web support — clean URLs, browser history, refresh-safe parsing
  • Transitions — material, fade, slide, none
  • Shell routes — nested navigation and tab branches
  • TestingFakeFlowRouter, engine unit tests, widget tests
  • Migration — helpers for GoRouter, Navigator, AutoRoute, Beamer

Quick Start

dependencies:
  flow_routing: ^2.0.0
import 'package:flow_routing/flow_routing.dart';

abstract final class Routes {
  static const home = FlowRoute(name: 'home', pathTemplate: '/');
}

final router = FlowRouter(
  routes: [
    flow('/', name: 'home', builder: (context, route) => const HomePage()),
  ],
);

void main() => runApp(FlowApp.router(router: router));

See Getting Started for the full guide.

Example App

A polished demo showcasing typed navigation, guards, middleware, and web URLs:

cd example
flutter run -d chrome   # Web
flutter run             # Mobile

Documentation

Guide Description
Getting Started Install and first routes
API Reference Complete public API
Architecture System design
Cookbook Recipes and patterns
Migration From GoRouter, AutoRoute, etc.
GoRouter Issues How Flow addresses 287+ issues

Project Structure

flow/
├── lib/           # Package source
├── example/       # Demo application
├── docs/          # Documentation
├── test/          # Unit & widget tests
└── benchmark/     # Performance benchmarks

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors