servicesList property

List<BluetoothService> get servicesList

Get services returns empty when:

  • disconnected
  • discoverServices() has not been called
  • your device does not have services (rare)

Implementation

List<BluetoothService> get servicesList {
  BmDiscoverServicesResult? result = FlutterBluePlus._knownServices[remoteId];
  if (result == null) {
    return [];
  } else {
    return result.services
        .map((p) => BluetoothService.fromProto(p))
        .where((p) => p.isPrimary)
        .toList();
  }
}