initState<S> method

Type initState <S>(
  1. [S initialValue]
)

Initializes the state either when first set or upon first retrieval.

Implementation

Type initState<S>([S initialValue]) {
  final type = _typeOf<S>();
  if (!_stateMap.containsKey(type)) {
    if (initialValue != null) {
      _stateMap[type] = BehaviorSubject<S>.seeded(initialValue);
    } else {
      _stateMap[type] = BehaviorSubject<S>();
    }
  }

  return type;
}