I have the following function that will return int? by accepting String.
int? convert(String s) {
// Some implementation
}
Then I have this function that will convert a Stream<String> to Stream<int>. My current implementation looks like the following.
Stream<int> convertStream(Stream<String> s) {
return s
.map<int?>((i) => convert(i))
.where((i) => i!=null)
.map<int>((i) => i!);
}
This way doesn't look nice to me. Is there any other way that can be used to achieve the same behavior?