parititon<T> static method
Splits the source
Observable into two, one with values that satisfy a
predicate
, and another with values that don't satisfy the predicate
.
Implementation
static PartitionedStream<T> parititon<T>(
Stream<T> source,
bool Function(T event) predicate,
) {
bool Function(T) not(bool Function(T event) test) =>
(event) => !test(event);
final stream = source.isBroadcast ? source : source.share();
return PartitionedStream(
stream.where(predicate),
stream.where(not(predicate)),
);
}