reduce method
Set args to some unique value if creator is used on the fly, or null if the creator defined in a stable variable. See CreatorBase.args.
Implementation
Emitter<T> reduce(
T Function(T previous, T element) combine, List<Object?>? args,
{String? name, bool keepAlive = false}) {
return Emitter<T>((ref, emit) async {
final previous = ref.readSelf();
final element = await ref.watch(this);
emit(previous == null ? element : combine(previous, element));
},
name: name ?? argsName(args) ?? '${infoName}_reduce',
keepAlive: keepAlive,
args: args);
}