cardRead method
if connected is true then you can call card read
Implementation
@override
Future<dynamic> cardRead({
required String amount,
required int tranType,
required String traceNo,
}) async {
cardReadError = null;
btCtr = Completer();
methodChannel.invokeMethod(
"bluetooth.card_read",
{
"amount": amount,
"tran_type": tranType,
"trace_no": traceNo,
"read_type": "4",
},
);
var ret = await btCtr?.future;
if (cardReadError != null) {
await Future.delayed(const Duration(seconds: 1));
btCtr = Completer();
methodChannel.invokeMethod(
"bluetooth.card_read",
{
"amount": amount,
"tran_type": tranType,
"trace_no": traceNo,
"read_type": "2"
},
);
return await btCtr?.future;
}
return ret;
}