zenrouter_file_annotation 3.0.0
zenrouter_file_annotation: ^3.0.0 copied to clipboard
Shared annotations and structure for ZenRouter file-based routing in Flutter and DartNative.
ZenRouter File Annotation #
Shared annotations and structure for ZenRouter file-based routing in Flutter and DartNative.
This package contains the annotations (@ZenRoute, @ZenLayout, @ZenCoordinator) and helper classes used by the zenrouter_file_generator to generate type-safe routes.
Installation #
This package is usually added automatically when using zenrouter_file_generator.
dependencies:
zenrouter_file_annotation: ^3.0.0
dev_dependencies:
zenrouter_file_generator: ^3.0.0
Usage #
Use these annotations to define your routes and layouts:
import 'package:zenrouter_file_annotation/zenrouter_file_annotation.dart';
@ZenRoute()
class MyRoute extends _$MyRoute { ... }
@ZenLayout(type: LayoutType.stack)
class MyLayout extends _$MyLayout { ... }
@ZenLayout(
type: LayoutType.branched,
branches: [HomeLayout, SettingsLayout],
)
class AppShellLayout extends _$AppShellLayout { ... }
// With query parameters
@ZenRoute(queries: ['search', 'page'])
class SearchRoute extends _$SearchRoute { ... }
See zenrouter_file_generator for complete documentation and usage examples.