init method
Initializes the HCE with the specified parameters
Implementation
@override
Future<void> init(
dynamic args,
StreamController<NfcApduCommand> streamController,
) async {
await methodChannel.invokeMethod('init', args);
methodChannel.setMethodCallHandler(
(call) async {
switch (call.method) {
case 'apduCommand':
final args = call.arguments;
final int port = args['port'];
final Uint8List command = args['command'];
Uint8List? data = args['data'];
if (data?.isEmpty ?? true) data = null;
developer.log(
'Received APDU command on port $port: ${command.map((e) => e.toRadixString(16))}'
'.${data == null ? '' : '\nAdditional data in command: ${data.map((e) => e.toRadixString(16))}'}',
name: 'NFC_HCE',
);
streamController.add(NfcApduCommand(port, command, data));
break;
}
},
);
}