UseAsyncState<T, A> constructor

UseAsyncState<T, A>(
  1. dynamic initial,
  2. AsyncFunction<T, A> asyncValue, [
  3. 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]);
}