??
Add the package, then move navigation ? overlays into explicit state. Keep imperative push/pop out ? the same stack.
Single dependency
Install ?? one pub command. No code generation setup is required.
State-first API
You control a List<PageEntry> ? optional OverlayRequest as pure state.
Incremental adoption
Start ?? one feature flow ? migrate screen by screen.
Install ? Initialize
Use pub add, then wire initial root state ? pages ? overlay.
Command
Initial ? 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 ? Resolver