flush method

FutureOr<void> flush(
  1. Atsign atsign,
  2. AtKeys atKeys
)

Persists atKeys as the complete new state for atsign.

This is the runtime counterpart to write: mutate the in-memory AtKeys (e.g. AtKeys.addKey), then flush the whole object. Implementations backed by durable storage must not lose data: when a target already exists, validate that everything in it is preserved in atKeys (see AtKeysAssurance.validateMapUpdate), then rewrite. When no target exists, flush creates it — there is nothing to lose.

The never-lose contract applies to stores of bootstrap key material (the .atKeys file, keychain). A store holding rotating or evictable material defines its own retention policy — deletion there is a feature (forward secrecy), not data loss.

The default implementation throws: pre-existing WrittenAtKeysIo implementations compile unchanged but must override flush to support runtime persistence.

Implementation

FutureOr<void> flush(Atsign atsign, AtKeys atKeys) {
  throw UnimplementedError(
      '$runtimeType does not implement flush(); override it to support '
      'runtime persistence');
}