reset method

void reset({
  1. ConfigScope? scope,
  2. String? key,
})

Reset configuration.

If key is given, only that key is reset within scope. Otherwise the entire scope is cleared. If scope is null, all scopes are cleared.

Implementation

void reset({ConfigScope? scope, String? key}) {
  if (scope != null && key != null) {
    remove(key, scope: scope);
    return;
  }
  if (scope != null) {
    final old = Map<String, dynamic>.from(_store[scope]!);
    _store[scope]!.clear();
    _sources[scope]!.clear();
    for (final k in old.keys) {
      _emitChange(k, old[k], null, scope);
    }
    return;
  }
  // Reset all scopes.
  for (final s in ConfigScope.values) {
    reset(scope: s);
  }
}