??

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

단일 의존성

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

상태 우선 API

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

점진적 도입

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

하나의 스택 안에서, PageEntry.key는 고유해야 합니다 Navigator의 페이지 식별자가 되기 때문입니다.