map method
void
map(
- Map<
String, dynamic> handlers, { - List<
RouteInterceptor> before = const [], - List<
RouteInterceptor> after = const [], - List<
ExceptionHandler> onException = const [],
Implementation
void map(
/* RouteFunc | RouteBuilder | Iterable<RouteFunc> | Iterable<RouteBuilder> */
Map<String, dynamic> handlers,
{List<RouteInterceptor> before = const [],
List<RouteInterceptor> after = const [],
List<ExceptionHandler> onException = const []}) {
for (String path in handlers.keys) {
Route rb;
dynamic v = handlers[path];
if (v is RouteHandler) {
rb = addRoute(Route(path, v));
rb._before.addAll(before);
rb._after.addAll(after);
rb._onException.addAll(onException);
} else if (v is Route) {
rb = addRoute(v);
rb._before.addAll(before);
rb._after.addAll(after);
rb._onException.addAll(onException);
} else if (v is Iterable<RouteHandler>) {
for (RouteHandler v1 in v) {
rb = addRoute(Route(path, v1));
rb._before.addAll(before);
rb._after.addAll(after);
rb._onException.addAll(onException);
}
} else if (v is Iterable<Route>) {
for (Route v1 in v) {
rb = addRoute(v1);
rb._before.addAll(before);
rb._after.addAll(after);
rb._onException.addAll(onException);
}
} else {
throw UnsupportedError('Handler not supported!');
}
}
}