prefer-correct-stream-return-type
Warns when a declaration that returns a Stream has an incorrect return type.
Object, dynamic, generic type or a nullable Stream are considered incorrect and should be replaced by a Stream.
Example
❌ Bad:
// LINT: This return type is expected to be a non-nullable 'Stream'.
dynamic function() async* {
return ...;
}
// LINT: This return type is expected to be a non-nullable 'Stream'.
Object function() async* {
return ...;
}
// LINT: This return type is expected to be a non-nullable 'Stream'.
Stream<int>? function() async* {
return ...;
}
// LINT: This return type is expected to be a non-nullable 'Stream'.
T function<T>() async* {
return ...;
}
✅ Good:
Stream<dynamic> function() async* {
return ...;
}
Stream<Object> function() async* {
return ...;
}
Stream<int> function() async* {
return ...;
}
Stream<T> function<T>() async* {
return ...;
}