nyRouteIdentifiesItsPage function

bool nyRouteIdentifiesItsPage(
  1. RouteView routeView
)

Whether the page a routeView builds can be read back from the route.

True for ("/my-page", (_) => MyPage()), where the closure returns the page and carries it in its runtime type. False for a builder declared to return Widget - a tear-off of a named function, or a variable typed as the RouteView signature - which carries that declared type instead, and so names no page.

A route that answers false is addressed by a name of its own, given to the page and used by every sender:

class MyPage extends NyStatefulWidget {
  static const String stateKey = "/my-page";

  MyPage({super.key})
      : super(child: () => _MyPageState(), stateName: stateKey);
}

Implementation

bool nyRouteIdentifiesItsPage(RouteView routeView) =>
    !_typeNamesThatNameNoPage.contains(nyWidgetTypeNameForRoute(routeView));