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
dynamic function() async* {
return ...;
}
// LINT
Object function() async* {
return ...;
}
// LINT
Stream<int>? function() async* {
return ...;
}
// LINT
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 ...;
}