canon_generator 0.24.0 copy "canon_generator: ^0.24.0" to clipboard
canon_generator: ^0.24.0 copied to clipboard

Code generator for canon — emits the typed Screen, Hop, and verb surface from the spec enum.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import 'nav.dart';

void main() {
  // Path URLs (/home not /#/home).
  usePathUrlStrategy();

  // Resolver: a nav-mirror Place (e.g. pasted /b/c/d) → go straight there; a bare
  // root / link / unparseable → land on `a`. Places are go-able Hops.
  Screen.resolver = (Url? url) => switch (url) {
        Place p => Screen.go(p),
        _ => Screen.goA(),
      };

  runApp(const _App());
}

class _App extends StatelessWidget {
  const _App();

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(routerDelegate: Screen.manager);
  }
}
1
likes
0
points
750
downloads

Publisher

unverified uploader

Weekly Downloads

Code generator for canon — emits the typed Screen, Hop, and verb surface from the spec enum.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, canon, source_gen

More

Packages that depend on canon_generator