systemDevices static method

Future<List<BluetoothDevice>> systemDevices(
  1. List<Guid> withServices
)

Retrieve a list of devices currently connected to the system

  • The list includes devices connected to by any app
  • You must still call device.connect() to connect them to your app
  • withServices required on iOS (for privacy purposes). ignored on android.

Implementation

static Future<List<BluetoothDevice>> systemDevices(List<Guid> withServices) async {
  var r = await _invokePlatform(
      () => FlutterBluePlusPlatform.instance.getSystemDevices(BmSystemDevicesRequest(withServices: withServices)));
  for (BmBluetoothDevice device in r.devices) {
    if (device.platformName != null) {
      _platformNames[device.remoteId] = device.platformName!;
    }
  }
  return r.devices.map((d) => BluetoothDevice.fromId(d.remoteId.str)).toList();
}