validateRequest method
- StateTransactionOperation operation, {
- required bool quiescent,
Rejects an unsupported or insufficiently quiesced request.
Implementation
void validateRequest(
StateTransactionOperation operation, {
required bool quiescent,
}) {
final supported = switch (operation) {
StateTransactionOperation.snapshot => supportsSnapshot,
StateTransactionOperation.restore => supportsRestore,
};
if (!supported) {
throw UnsupportedError(
'${operation.name} state transactions are not supported.');
}
if (requiresQuiescence(operation) && !quiescent) {
throw StateError(
'${operation.name} requires the component to be quiescent.');
}
}