copyWith method Null safety

CustomColors copyWith(
  1. {Color? sourceGold,
  2. Color? gold,
  3. Color? onGold,
  4. Color? goldContainer,
  5. Color? onGoldContainer,
  6. Color? sourceVanilla,
  7. Color? vanilla,
  8. Color? onVanilla,
  9. Color? vanillaContainer,
  10. Color? onVanillaContainer,
  11. Color? sourceMauve,
  12. Color? mauve,
  13. Color? onMauve,
  14. Color? mauveContainer,
  15. Color? onMauveContainer}
)
override

Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.

Implementation

@override
CustomColors copyWith({
  Color? sourceGold,
  Color? gold,
  Color? onGold,
  Color? goldContainer,
  Color? onGoldContainer,
  Color? sourceVanilla,
  Color? vanilla,
  Color? onVanilla,
  Color? vanillaContainer,
  Color? onVanillaContainer,
  Color? sourceMauve,
  Color? mauve,
  Color? onMauve,
  Color? mauveContainer,
  Color? onMauveContainer,
}) {
  return CustomColors(
    sourceGold: sourceGold ?? this.sourceGold,
    gold: gold ?? this.gold,
    onGold: onGold ?? this.onGold,
    goldContainer: goldContainer ?? this.goldContainer,
    onGoldContainer: onGoldContainer ?? this.onGoldContainer,
    sourceVanilla: sourceVanilla ?? this.sourceVanilla,
    vanilla: vanilla ?? this.vanilla,
    onVanilla: onVanilla ?? this.onVanilla,
    vanillaContainer: vanillaContainer ?? this.vanillaContainer,
    onVanillaContainer: onVanillaContainer ?? this.onVanillaContainer,
    sourceMauve: sourceMauve ?? this.sourceMauve,
    mauve: mauve ?? this.mauve,
    onMauve: onMauve ?? this.onMauve,
    mauveContainer: mauveContainer ?? this.mauveContainer,
    onMauveContainer: onMauveContainer ?? this.onMauveContainer,
  );
}