I need to create a new Stream<Foo>
from EventChannel in my plugin, I try to do it like this, but i had Stream<Foo?>
, what I mast to do for filtred all null values and return as Stream<Foo>
Stream<Foo> get getStream {
return _eventChannel
.receiveBroadcastStream()
.map<Foo?>((dynamic status) {
assert(
status is int,
'status should be int, but it is ${status.runtimeType}',
);
if (status is int) {
return FooStatus.valueOf(status); // can be null
}
}).helpMeFiltredLikeThis<Foo>((Foo? value) => value != null); // how i can do some like this
}