Closed LIUbacon closed 6 months ago
Flutter版本2.5.0,dart2.14.0,使用的flutter_nfc_kit: ^3.4.2
//读取扇区数据
Future
await FlutterNfcKit.authenticateSector(0,keyA: keyA,keyB: keyB);
var data = await FlutterNfcKit.readSector(0); // read one sector, or
var data2 = await FlutterNfcKit.readBlock(0); // read one block
print(data);
print(data2);
} catch(e){
print('读取失败$e');
}
}
} 都是提示读取失败'package:flutter_nfc_kit/flutter_nfc_kit.dart': Failed assertion: line 453 pos 12: 'T is String || T is Uint8List': is not true.
//读取
Future readBlock() async {
if (tag.type == NFCTagType.mifare_classic) {
try{
} 提示:读取失败'package:flutter_nfc_kit/flutter_nfc_kit.dart': Failed assertion: line 453 pos 12: 'T is String || T is Uint8List': is not true.
'package:flutter_nfc_kit/flutter_nfc_kit.dart'部分代码 Uint8List 提示错误 手动添加import 'dart:typed_data'; /// Transceive data with the card / tag in the format of APDU (iso7816) or raw commands (other technologies). /// The [capdu] can be either of type Uint8List or hex string. /// Return value will be in the same type of [capdu]. /// /// There must be a valid session when invoking. /// /// On Android, [timeout] parameter will set transceive execution timeout that is persistent during a active session. /// Also, Ndef TagTechnology will be closed if active. /// On iOS, this parameter is ignored and is decided by the OS. /// On Web, [timeout] is currently not /// Timeout is reset to default value when [finish] is called, and could be changed by multiple calls to [transceive]. static Future transceive(T capdu, {Duration? timeout}) async {
assert(capdu is String || capdu is Uint8List);
return await _channel.invokeMethod('transceive', {
'data': capdu,
'timeout': timeout?.inMilliseconds ?? TRANSCEIVE_TIMEOUT
});
}