Iterable<Middleware> resolveMiddleware(Iterable tokens, [IoCContainer container])

Source

Iterable<shelf.Middleware> resolveMiddleware(Iterable tokens, [IoCContainer container]) sync* {
  final ioc = container ?? context.container;
  for (final token in tokens) {
    if (token is shelf.Middleware) {
      yield token;
    } else if (token is Function) {
      yield handler(token);
    } else if (token is Type) {
      if (!reflectType(token).isAssignableTo(reflectType(Middleware))) {
        throw new ArgumentError('[$token] must be assignable to [Middleware]');
      }
      yield ioc.make(token);
    } else if (token is Iterable) {
      yield* resolveMiddleware(token);
    }
  }
}