Instalaci?n
Add the package, then move navigation y overlays into explicit state. Keep imperative push/pop out de the same stack.
Single dependency
Install con one pub command. No code generation setup is required.
State-first API
You control a List<PageEntry> y optional OverlayRequest as pure state.
Incremental adoption
Start de one feature flow y migrate screen by screen.
Install y Initialize
Use pub add, then wire initial root state para pages y overlay.
Command
Initial app State
import 'package:declarative_nav/declarative_nav.dart';
class _AppRootState extends State<AppRoot> {
OverlayRequest? _overlay;
late List<PageEntry> _pages;
@override
void initState() {
super.initState();
_pages = const [
PageEntry(key: 'home', name: '/home'),
];
}
}
Constraint
Inside one stack, PageEntry.key must stay unique because it becomes the Navigator page identity.
Previous
IntroductionNext
Pages y Resolver