Pages as Data, UI via Resolver

Store only metadata in PageEntry. Use buildPage to map each page key to an actual widget.

Serializable state

PageEntry is plain data, so navigation state can be logged, diffed, and replayed.

Simple resolver

A switch on page.key keeps routing explicit and reviewable.

One source of truth

Push and pop are list operations on _pages, not side effects.

Resolver Pattern

Build by page key and mutate the page list declaratively.

Page State Rule

Resolver Example

Widget _buildPage(BuildContext context, PageEntry page) {
  switch (page.key) {
    case 'home':
      return HomePage(onGoDetail: _goDetail);
    case 'detail':
      return const DetailPage();
    default:
      return const SizedBox.shrink();
  }
}

void _goDetail() {
  setState(() => _pages = [..._pages, const PageEntry(key: 'detail', name: '/detail')]);
}
Keep Metadata Lean

Avoid placing Widget instances into navigation state and keep PageEntry as pure metadata for maintainability.

পূর্ববর্তী

ইনস্টলেশন

পরবর্তী

ট্যাব