DataStateRoutePageBuilder3<D, DAnc1, DAnc2> typedef

DataStateRoutePageBuilder3<D, DAnc1, DAnc2> = Page<void> Function(BuildContext context, Widget wrapPageContent(DataStateRouteBuilder3<D, DAnc1, DAnc2> buildPageContent))

A function that can build a routing Page that provides a visualization of an active data state in a state tree.

The function is provided a build context, and a wrapPageContent function that must be called in order to wrap the contents of the route in a specialized widget that detects statw transitions and re-renders this route as necessary. The return value of the wrapPageContent function should be used as the contents of the page.

var routerConfig = TreeStateRouter(
  routes: [
    DataStateRoute(
      States.dataState1,
      pageRouteBuilder: (buildContext, wrapPageContent) {
        return MaterialPage(child: wrapPageContent((ctx, stateCtx, data) {
           return const Center(child: Text('State data value: $data');
         }));
      }),
  ]);

Implementation

typedef DataStateRoutePageBuilder3<D, DAnc1, DAnc2> = Page<void> Function(
  BuildContext context,
  Widget Function(DataStateRouteBuilder3<D, DAnc1, DAnc2> buildPageContent)
      wrapPageContent,
);