getUsbEventStream method
Implementation
Stream<UsbEvent> getUsbEventStream() {
return AbaPosSdkFlutterPlatform.instance
.getDeviceConnectionListener()
.receiveBroadcastStream()
.map((msg) {
// msg is trigger from native side which convert from Map to String
final str = msg.toString();
// replace '=' to ':' to become json format for serialization process
final json = str.replaceAll(RegExp(r'='), ":");
final result = UsbEvent.fromJson(json);
return result;
});
}