getPairedDevices method

  1. @override
Future<List<BluetoothDeviceModel>> getPairedDevices()
override

Get list of paired devices

Implementation

@override
Future<List<BluetoothDeviceModel>> getPairedDevices() async {
  try {
    final result = await _methodChannel.invokeMethod<List>('getPairedDevices');
    return (result ?? [])
        .map((device) => BluetoothDeviceModel.fromMap(Map<String, dynamic>.from(device)))
        .toList();
  } catch (e) {
    throw BluetoothException('Failed to get paired devices: $e');
  }
}