getAndroidPairedDevices method

  1. @override
Future<List<BluetoothDevice>> getAndroidPairedDevices()
override

Get paired devices for Android. For iOS, it will return an empty list. Throw BTException if failed.

Implementation

@override
Future<List<BluetoothDevice>> getAndroidPairedDevices() async {
  if (!Platform.isAndroid) return [];
  try {
    final List list = await methodChannel.invokeMethod('getBondedDevices');
    return list.map((e) => BluetoothDevice.fromMap(e)).toList();
  } on PlatformException catch (e) {
    throw BTException.fromPlatform(e);
  }
}