unregister static method

bool unregister(
  1. String key
)

Unregisters a state contributor.

Removes a previously registered state contributor from the checkpoint system. After unregistering, the state will no longer be included in snapshots and cannot be restored.

Example:

StateSnapshot.unregister('user_state');

Parameters:

  • key: The key of the state contributor to unregister

Returns: true if the key was found and removed, false if it was not registered.

Throws:

Note: Unregistering a state contributor does not affect snapshots that were already captured. It only affects future snapshot captures and restores.

Implementation

static bool unregister(String key) {
  ensureEnabled();
  return SnapshotRegistry.instance.unregister(key);
}