exec method
Executes all commands queued after multi().
Returns a List<dynamic> of replies for each command in the transaction.
Returns null if the transaction was aborted (e.g., due to a WATCH failure).
Throws a ValkeyServerException (e.g., EXECABORT) if the transaction
was discarded due to a command syntax error within the MULTI block.
Implementation
@override
Future<List<dynamic>?> exec() async {
if (!_isInTransaction) {
throw Exception('Cannot call EXEC without MULTI.');
}
final response = await execute(['EXEC']);
// Server responds with an Array (*) of responses
// or Null ($-1 or *-1) if transaction was aborted (e.g., WATCH)
if (response == null) {
return null;
}
return response as List<dynamic>;
}