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