getDiscoveredDevices method

Future<List<BluetoothDevice>> getDiscoveredDevices()

Get discovered devices from the last discovery session

Implementation

Future<List<BluetoothDevice>> getDiscoveredDevices() async {
  try {
    final List<dynamic> devices =
        await _channel.invokeMethod('getDiscoveredDevices');
    return devices.map((device) => BluetoothDevice.fromMap(device)).toList();
  } catch (e) {
    throw BluetoothException('Failed to get discovered devices: $e');
  }
}