routerGenerate method Null safety

Route routerGenerate(
  1. RouteSettings settings
)

generate a route ,you must add this to app.

Implementation

Route<dynamic> routerGenerate(RouteSettings settings) {
  RouteSettings routeSettings = settings;
  _interceptors.forEach((interceptor) {
    routeSettings = interceptor.onRequest(routeSettings);
  });
  Object? params = routeSettings.arguments;
  RRouterWidgetBuilder? builder = _routeMap[routeSettings.name!];
  if (builder != null) {
    return _pageGenerate(
        routeSettings, (BuildContext context) => builder(params));
  } else {
    try {
      assert(notFoundPage != null,
          "Please Setting Not Found page.such as:`RRouter.myRouter.notFoundPage = Text('')`");
      return _pageGenerate(routeSettings,
          (BuildContext context) => notFoundPage!.call(routeSettings.name));
    } catch (_) {
      String error =
          "No registered route was found to handle '${routeSettings.name}'.";
      throw RRouterNotFoundException(error, routeSettings.name);
    }
  }
}