reactive<T> method

ReactiveProperty<T> reactive<T>(
  1. T initialValue, {
  2. String? key,
})

Implementation

ReactiveProperty<T> reactive<T>(T initialValue, {String? key}) {
  final propertyKey = key ?? '${T}_${_propertyCounter++}';

  if (!_properties.containsKey(propertyKey)) {
    print('Creating reactive property with key: $propertyKey, initial value: $initialValue');
    _properties[propertyKey] = ReactiveProperty<T>(initialValue, _notify);
  } else {
    print('Reusing existing reactive property with key: $propertyKey');
  }

  return _properties[propertyKey] as ReactiveProperty<T>;
}