methodChannel property

  1. @visibleForTesting
MethodChannel methodChannel
final

The method channel used to interact with the native platform.

Implementation

@visibleForTesting
final methodChannel = const MethodChannel('xprinter_sdk')..setMethodCallHandler((MethodCall call) async {
  if (call.method == "findBluetoothDevices") {
    List<BluetoothDevice> result = [];
    if ((call.arguments as String).isNotEmpty) {
      (jsonDecode(call.arguments as String) as List<dynamic>).forEach((dynamic device) {
        result.add(BluetoothDevice(mac: device['mac'] ?? '', name: device['name']));
      });
    }
    _deviceLinstener.add(result);
  }
});