Installatie
Add the package, then move navigation and overlays into explicit state. Keep imperative push/pop out of the same stack.
Eén afhankelijkheid
Install with one pub command. No code generation setup is required.
Status-eerst API
You control a List<PageEntry> and optional OverlayRequest as pure state.
Stapsgewijze invoering
Begin met één functiestroom en migreer scherm voor scherm.
Installeren en initialiseren
Gebruik pub add en koppel daarna de initiële rootstatus voor pagina's en overlay.
Commando
Initiële appstatus
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'),
];
}
}
Beperking
Binnen één stack, PageEntry.key moet uniek blijven omdat het de pagina-identiteit van de Navigator wordt.
Vorige
IntroductieVolgende
Pagina's als data