combines<R> method
SReadOnlyState<R>
combines<R>(
- List<
SBaseState> others, - SCombinerMultipleFunction<
R, dynamic> combiner
inherited
Implementation
@override
SReadOnlyState<R> combines<R>(List<SBaseState> others, SCombinerMultipleFunction<R, dynamic> combiner) {
var defaultValues = [_initialData, ...others.map((e) => e._initialData)];
var streams = [_controller.stream, ...others.map((e) => e._controller.stream)];
var t = _CombinerStream._combine(
streams: streams,
combiner: (values) {
return combiner(values);
},
defaultValues: defaultValues,
);
var initial = (defaultValues.length == streams.length) ? combiner(defaultValues) : null;
return SReadOnlyState._fromStream(t.stream, initial);
}