use<T> method

Reactive<T> use<T>(
  1. String key,
  2. T initialValue
)

Tạo mới hoặc lấy reactive state theo key

Implementation

Reactive<T> use<T>(String key, T initialValue) {
  if (_states.containsKey(key)) {
    return _states[key]! as Reactive<T>;
  } else {
    final state = Reactive<T>(initialValue);
    _states[key] = state;
    return state;
  }
}