lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.67k stars 417 forks source link

notFoundHanler == null #269

Open LatCui opened 2 years ago

LatCui commented 2 years ago

`AppRouteMatch? match = _routeTree.matchRoute(path!); AppRoute? route = match?.route; if (transitionDuration == null && route?.transitionDuration != null) { transitionDuration = route?.transitionDuration; }

Handler handler = (route != null ? route.handler : notFoundHandler);
TransitionType? transition = transitionType;
if (transitionType == null) {
  transition = route != null ? route.transitionType : TransitionType.native;
}
if (route == null && notFoundHandler == null) {
  return RouteMatch(
      matchType: RouteMatchType.noMatch,
      errorMessage: "No matching route was found");
}
Map<String, List<String>> parameters =
    match?.parameters ?? <String, List<String>>{};
if (handler.type == HandlerType.function) {
  handler.handlerFunc(buildContext, parameters);
  return RouteMatch(matchType: RouteMatchType.nonVisual);
}`

if notFoundHandler == null && route == null, Handler handler = (route != null ? route.handler : notFoundHandler); shoud use Handler? handler ,or if (route == null && notFoundHandler == null) can’t execute