getCardNumber static method
Implementation
static Future<ReadCardInfo?> getCardNumber() async {
/// Stream method
final stream = FlutterNewposSdk._methodStream.stream
.where((m) => m.method == 'OnGetReadCardInfo')
.map((m) {
final arguments = m.arguments as Map<Object?, Object?>;
final convertedMap = <String, dynamic>{};
arguments.forEach((key, value) {
if (key is String) {
convertedMap[key] = value;
}
});
return ReadCardInfo.fromJson(convertedMap);
});
try {
await _invokeMethod('getCardNumber', 30);
final streamOutput = await getFirstResultInStream(
stream,
const Duration(seconds: 30),
);
// ! Puede devolver true, pero con un resultado que no es exitoso
return streamOutput;
} on TimeoutException {
rethrow;
} catch (e) {
throw BluetoothConnectionFailed(code: '');
}
}