unregister method

void unregister(
  1. Persister persister
)

Unregisters the specified persister.

Throws ConflictingPersisterException if the persister currently registered for persister.supportedType is not persister itself.

Implementation

void unregister(Persister persister) {
  // Ensure that the persister is indeed the one currently registered for
  // the specific type.
  final value = _knownPersisters[persister.supportedType];
  if (_knownPersisters[persister.supportedType] != persister) {
    throw ConflictingPersisterException(
        'Trying to unregister persister ${persister.runtimeType} with '
        'supporedType="${persister.supportedType}", but found in registry '
        '$value in that slot.');
  }
  _knownPersisters.remove(persister.supportedType);
}