getBondedDevices method

Future<List<BluetoothDevice>> getBondedDevices()

Gets and updates the bonded devices

Implementation

Future<List<BluetoothDevice>> getBondedDevices() async {
  final List<dynamic> result = await _channel.invokeMethod('getBondedDevices');
  final devices = result.map((deviceMap) => BluetoothDevice.fromMap(deviceMap)).toList();

  // Update the bonded devices list
  _bondedDevices.clear();
  _bondedDevices.addAll(devices);

  return devices;
}