copyWith method

Battery copyWith({
  1. int? level,
  2. String? health,
  3. String? status,
  4. String? powerSource,
  5. String? technology,
  6. String? temperature,
  7. String? voltage,
  8. String? powerProfile,
})

copyWith is the method to copy the class.

Implementation

Battery copyWith({
  int? level,
  String? health,
  String? status,
  String? powerSource,
  String? technology,
  String? temperature,
  String? voltage,
  String? powerProfile,
}) {
  return Battery(
    level: level ?? this.level,
    health: health ?? this.health,
    status: status ?? this.status,
    powerSource: powerSource ?? this.powerSource,
    technology: technology ?? this.technology,
    temperature: temperature ?? this.temperature,
    voltage: voltage ?? this.voltage,
    powerProfile: powerProfile ?? this.powerProfile,
  );
}