ensureEnabled static method
Ensures checkpoint is enabled, throwing if it's not.
This is used internally by all checkpoint operations to ensure they fail gracefully when checkpoint is disabled.
Throws StateError if checkpoint is not enabled.
Note: This method is public for testing purposes but should be considered internal API. It will be used by future checkpoint operations (capture, restore, etc.).
Implementation
@visibleForTesting
static void ensureEnabled() {
if (!_enabled) {
throw StateError(
'Checkpoint is not enabled. Call StateSnapshot.enable() inside an '
'assert block to enable checkpoint functionality.\n'
'Example:\n'
'assert(() {\n'
' StateSnapshot.enable();\n'
' return true;\n'
'}());',
);
}
}