Skip to content

fespalierFile-tree routing for Flutter

In the spirit of Next.js. An espalier is a tree trained flat against a frame; here the frame is lib/app/.

fespalier

You write plain widgets and functions in small files under lib/app/, and fsp gen, fsp watch or fsp dev turns them into lib/app.g.dart:

text
lib/main.dart            Future<void> main() => AppMain.run();
lib/app/
  layout.dart            AppLayout({required Widget child})            the shell around everything below
  page.dart              HomePage()                                     → /
  products/
    page.dart            ProductsPage({required List<Product> products})   → /products
    $id/
      data.dart          Future<Product> data(Ref ref, {required int id})
      page.dart          ProductPage({required Product product})           → /products/:id
      action.dart        Future<void> action(Ref ref, {required int id, required Refund input})
  checkout/guard.dart    GuardResult guard(Ref ref)                     guards this folder and below
  (account)/             a group: a shared layout, nothing added to the URLs
  _components/           private: never routes
dart
Future<void> main() => AppMain.run();                       // the whole main()

ProductRoute(id: 42).go(context);                           // typed navigation
ProductRoute.watch(ref, id: 42);                            // the route's data: AsyncValue<Product>
await ProductRoute.submit(ref, id: 42, input: refund);      // its write, with pending and error state

Start with Installation and setup, then File kinds and Routing. All pages lists every topic, one page each. fespalier is an early version (pre-1.0): what changed per release is in the changelog, and what it does not do yet is in the roadmap.

Released under the MIT License.