createState method Null safety

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

Implementation

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

        if (stream is ObservableStream<T>) return stream;
        return stream.asObservable(
          name: name != null ? 'StreamBinder<$T>@$name' : 'StreamBinder<$T>',
        );
      },
      observeFrom: (computedState) {
        if (computedState.error != null) throw computedState.error as Object;
        if (computedState.status != StreamStatus.waiting) {
          return computedState.value;
        } else {
          return null;
        }
      },
      disposeState: null,
      pendingValue: pendingValue,
      catchError: catchError,
      equals: equals,
      disposeValue: dispose,
      locator: locator,
      key: key,
    );