buildGoRouteForSPA method

GoRoute buildGoRouteForSPA(
  1. (Widget, StatefulBranchInfoProvider) allPagesWithConfigs,
  2. AppAttributes appAttributes
)

Implementation

GoRoute buildGoRouteForSPA(
  (Widget, StatefulBranchInfoProvider) allPagesWithConfigs,
  AppAttributes appAttributes,
) {
  return GoRoute(
    path: allPagesWithConfigs.$2.getRoutingName(),
    pageBuilder: (context, state) {
      return NoTransitionPage(
        child: Builder(
          builder: (context) {
            final currentAttributes = AppAttributesScope.maybeOf(context);
            if (currentAttributes == null) return allPagesWithConfigs.$1;
            return getAllPagesWithConfigs(currentAttributes)
                .firstWhere(
                  (page) =>
                      page.$2.getRoutingName() ==
                      allPagesWithConfigs.$2.getRoutingName(),
                )
                .$1;
          },
        ),
      );
    },
  );
}