安裝

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 OverlayRequest as pure state.

Incremental adoption

Start from one feature flow and migrate screen by screen.

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> {
  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.

上一頁

簡介