Installation
Add the package, then move navigation and overlays into explicit state. Keep imperative push/pop out of the same stack.
Single dependency
Install with one pub command. No code generation setup is required.
State-first API
You control a List<PageEntry> and optional OverlayBeiðni as pure state.
Incremental adoption
Start from one feature flæði and migrate skjár by skjár.
Install and Initialize
Use pub add, then wire initial root state for pages and overlay.
Command
Initial App State
import 'package:declarative_nav/declarative_nav.dart';
class _AppRootState extends State<AppRoot> {
OverlayBeiðni? _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 and Resolver