UseAsyncState<T, A> constructor
UseAsyncState<T, A> (
- dynamic initial,
- AsyncFunction<
T, A> asyncValue, [ - ReactterHookManager? context
Implementation
UseAsyncState(
initial,
this.asyncValue, [
this.context,
]) : _initial = initial,
super(context) {
UseEffect(() {
_status.value = UseAsyncStateStatus.done;
}, [_value]);
UseEffect(() {
if (_error.value != null) {
_status.value = UseAsyncStateStatus.error;
}
}, [_error]);
}