rollbackTransaction method
Future<void>
rollbackTransaction({
- required TransactionHeaders headers,
- required Transaction transaction,
override
Rolls back a transaction.
headers
are the headers to be sent with the request.transaction
is the transaction to be rolled back.
Implementation
@override
Future<void> rollbackTransaction({
required TransactionHeaders headers,
required Transaction transaction,
}) async {
await start();
final response = await fetch(
_endpoint.resolve('/transaction/${transaction.id}/rollback'),
method: 'POST',
headers: headers,
);
final result = await response.json();
return switch (result) {
{'errors': final Iterable errors} => throw Exception(errors),
_ => null,
};
}