genericTypeWhenFutureOrStream function

DartType? genericTypeWhenFutureOrStream(
  1. DartType type
)

Implementation

DartType? genericTypeWhenFutureOrStream(DartType type) {
  if (type is ParameterizedType &&
      type.typeArguments.isNotEmpty &&
      (type.isDartAsyncFuture ||
          type.isDartAsyncFutureOr ||
          const TypeChecker.fromRuntime(Stream).isAssignableFromType(type))) {
    return genericTypeWhenFutureOrStream(type.typeArguments[0]) ??
        type.typeArguments[0];
  }
  return null;
}