copyWith method

BleDevice copyWith({
  1. String? deviceId,
})

Returns a copy of this device with deviceId optionally replaced.

The copy re-derives the sanitised name from rawName so both survive unchanged — passing name straight to the constructor would overwrite rawName with the already-sanitised name.

Implementation

BleDevice copyWith({String? deviceId}) => BleDevice(
      deviceId: deviceId ?? this.deviceId,
      name: rawName,
      rssi: rssi,
      paired: paired,
      services: services,
      isSystemDevice: isSystemDevice,
      manufacturerDataList: manufacturerDataList,
      serviceData: serviceData,
      timestamp: timestamp,
      timestampMicroseconds: timestampMicroseconds,
      connectable: connectable,
    );