services property

Returns a list of Bluetooth GATT services offered by the remote device This function requires that discoverServices has been completed for this device

Implementation

Stream<List<BluetoothService>> get services async* {
  if (Platform.isWindows) {
    if (_bleServices.isEmpty) {
      if (_isDiscoveringServices.value != true)
        yield await discoverServices();
    } else {
      yield _bleServices.values.toList();
      return;
    }
  } else {
    yield await FlutterBluePlugin.instance._channel
        .invokeMethod('services', id.toString())
        .then((buffer) =>
            new protos.DiscoverServicesResult.fromBuffer(buffer).services)
        .then(
            (i) => i.map((s) => new BluetoothService.fromProto(s)).toList());
    yield* _services.stream;
  }
}