ਇੰਸਟਾਲੇਸ਼ਨ

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

ਇੱਕੋ dependency

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

ਸਟੇਟ-ਪਹਿਲੀ API

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

ਕਦਮ-ਦਰ-ਕਦਮ ਅਪਣਾਉਣਾ

ਇੱਕ feature flow ਤੋਂ ਸ਼ੁਰੂ ਕਰੋ ਅਤੇ screen by screen migrate ਕਰੋ।

ਇੰਸਟਾਲ ਕਰੋ ਅਤੇ ਸ਼ੁਰੂ ਕਰੋ

pub add ਵਰਤੋ, ਫਿਰ pages ਅਤੇ overlay ਲਈ ਸ਼ੁਰੂਆਤੀ root state ਜੋੜੋ।

Command

ਸ਼ੁਰੂਆਤੀ ਐਪ 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

ਇੱਕ stack ਦੇ ਅੰਦਰ, PageEntry.key ਵਿਲੱਖਣ ਰਹਿਣੀ ਚਾਹੀਦੀ ਹੈ ਕਿਉਂਕਿ ਇਹ Navigator page identity ਬਣ ਜਾਂਦੀ ਹੈ।