Instalaci?n
Add the package, then move navigation and overlays into explicit state. Keep imperative push/pop out of the same stack.
Dependencia única
Install with one pub command. No code generation setup is required.
API basada en el estado
You control a List<PageEntry> and optional OverlayRequest as pure state.
Adopción gradual
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
Dentro de una sola pila, PageEntry.key debe seguir siendo único porque se convierte en la identidad de la página de Navigator.
Previous
IntroductionNext
Pages y Resolver