addStateSource<S> method
StreamSubscription<S> ?
addStateSource<S>(
- Future<
S> source, { - void onData(
- S data
- void onDone()?,
- void onError(
- dynamic error
Adds Future that should be returned by state of S
type as source of state.
Callbacks onData
, onDone
, onError
provide possibility to handle source
.
Throws ArgumentError if state of such type was not registered.
Returns StreamSubscription that provide possibility to pause, resume or cancel source
.
Returns null
if this Bloc was disposed.
Implementation
@protected
StreamSubscription<S>? addStateSource<S>(Future<S> source,
{void Function(S data)? onData,
void Function()? onDone,
void Function(dynamic error)? onError}) =>
addStatesSource(source.asStream(),
onData: onData, onDone: onDone, onError: onError);