startTransaction method

  1. @override
Future<TransactionResult> startTransaction(
  1. TransactionRequest request
)
override

Begin a transaction. Emits the reader prompts and card-data events on events; the returned future completes with the terminal TransactionResult once the gateway response (via em-api) is known or the operation otherwise resolves.

Implementation

@override
Future<TransactionResult> startTransaction(TransactionRequest request) async {
  final result = await _invoke<Object?>(
    MobileReaderChannels.startTransaction,
    <String, dynamic>{
      MobileReaderChannels.argRequest: request.toJson(),
    },
  );
  if (result is! Map) {
    throw ReaderError(
      code: ReaderErrorCode.internalError,
      message: 'startTransaction: native returned non-map result',
      nativeCode: result.runtimeType.toString(),
    );
  }
  return TransactionResult.fromJson(_asStringDynamicMap(result));
}