Nutzungshandbuch

Add the package, then move navigation and overlays into explicit state. Keep imperative push/pop out of the same stack.

Einzelne Abhängigkeit

Install with one pub command. No code generation setup is required.

Zustandsorientierte API

You control a List<PageEntry> and optional OverlayRequest as pure state.

Schrittweise Einführung

Beginne mit einem Funktionsfluss und migriere Bildschirm für Bildschirm.

Installieren und initialisieren

Verwende pub add und verdrahte dann den initialen Root-Zustand für Seiten und Overlay.

Befehl

Initialer App-Zustand

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'),
    ];
  }
}
Einschränkung

Innerhalb eines Stacks, muss PageEntry.key eindeutig bleiben weil es zur Seitenidentität im Navigator wird.