createState method

  1. @override
BinderState<T> createState(
  1. ObservableLocator locator
)
override

Implementation

@override
BinderState<T> createState(ObservableLocator locator) =>
    BinderState.create<T, ObservableFuture<T>>(
      computeState: (locator, currentValue, currentState) {
        final future = fn(locator, currentValue, currentState);

        if (future is ObservableFuture<T>) return future;
        return future.asObservable(
          name: name != null ? 'FutureBinder<$T>@$name' : 'FutureBinder<$T>',
        );
      },
      observeFrom: (computedState) {
        if (computedState.error != null) throw computedState.error as Object;
        return computedState.value;
      },
      disposeState: null,
      pendingValue: pendingValue,
      catchError: catchError,
      equals: equals,
      disposeValue: dispose,
      locator: locator,
      key: key,
    );