register method

void register(
  1. StateSnapshotParticipant participant
)

Registers a participant under a unique logical path.

Implementation

void register(StateSnapshotParticipant participant) {
  if (participant.path.isEmpty) {
    throw ArgumentError.value(participant.path, 'path', 'Must not be empty.');
  }
  if (participant.schemaVersion <= 0) {
    throw ArgumentError.value(
        participant.schemaVersion, 'schemaVersion', 'Must be positive.');
  }
  if (_participants.any((existing) => existing.path == participant.path)) {
    throw ArgumentError('Duplicate snapshot participant path '
        '${participant.path}.');
  }
  _participants.add(participant);
}