toRoute<T> method

Route<T> toRoute<T>(
  1. RouteSettings settings
)

Implementation

Route<T> toRoute<T>(RouteSettings settings) {
  final routeName = settings.name ?? "";
  if (routeName.isNotEmpty) {
    for (final element in _route.entries) {
      if (RegExp(parsePattern(element.key), caseSensitive: false).hasMatch(routeName)) {
        return MaterialPageRoute(
          settings: settings,
          builder: (context) {
            return _build(
              child: element.value(
                context,
                RouteDataGeneralLibFlutter(
                  routeName: settings.name ?? element.key,
                  arguments: settings.arguments,
                  context: context,
                ),
              ),
            );
          },
        );
      }
    }
  }
  return MaterialPageRoute(
    settings: settings,
    builder: (context) {
      return _build(
        child: onUnknownRoute(
          context,
          RouteDataGeneralLibFlutter(
            routeName: settings.name ?? "",
            arguments: settings.arguments,
            context: context,
          ),
        ),
      );
    },
  );
}