State constructor

State(
  1. DataStorage storage,
  2. String name
)

Implementation

State(this.storage, this.name) {
  if (!DataStorage.isValidKeyName(name)) {
    throw ArgumentError('Invalid State name: $name');
  }

  if (!storage.registerState(this)) {
    throw StateError(
        'DataStorage[${storage.id}] already have a registered State[$name]!');
  }

  _load();
}