copyWith method Null safety

ColorScheme copyWith(
  1. {Brightness? brightness,
  2. Color? primary,
  3. Color? onPrimary,
  4. Color? primaryContainer,
  5. Color? onPrimaryContainer,
  6. Color? secondary,
  7. Color? onSecondary,
  8. Color? secondaryContainer,
  9. Color? onSecondaryContainer,
  10. Color? tertiary,
  11. Color? onTertiary,
  12. Color? tertiaryContainer,
  13. Color? onTertiaryContainer,
  14. Color? error,
  15. Color? onError,
  16. Color? errorContainer,
  17. Color? onErrorContainer,
  18. Color? background,
  19. Color? onBackground,
  20. Color? surface,
  21. Color? onSurface,
  22. Color? surfaceVariant,
  23. Color? onSurfaceVariant,
  24. Color? outline,
  25. Color? shadow,
  26. Color? inverseSurface,
  27. Color? onInverseSurface,
  28. Color? inversePrimary,
  29. Color? surfaceTint,
  30. @Deprecated('Use primary or primaryContainer instead. ' 'This feature was deprecated after v2.6.0-0.0.pre.') Color? primaryVariant,
  31. @Deprecated('Use secondary or secondaryContainer instead. ' 'This feature was deprecated after v2.6.0-0.0.pre.') Color? secondaryVariant}
)

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

Implementation

ColorScheme copyWith({
  Brightness? brightness,
  Color? primary,
  Color? onPrimary,
  Color? primaryContainer,
  Color? onPrimaryContainer,
  Color? secondary,
  Color? onSecondary,
  Color? secondaryContainer,
  Color? onSecondaryContainer,
  Color? tertiary,
  Color? onTertiary,
  Color? tertiaryContainer,
  Color? onTertiaryContainer,
  Color? error,
  Color? onError,
  Color? errorContainer,
  Color? onErrorContainer,
  Color? background,
  Color? onBackground,
  Color? surface,
  Color? onSurface,
  Color? surfaceVariant,
  Color? onSurfaceVariant,
  Color? outline,
  Color? shadow,
  Color? inverseSurface,
  Color? onInverseSurface,
  Color? inversePrimary,
  Color? surfaceTint,
  @Deprecated(
    'Use primary or primaryContainer instead. '
    'This feature was deprecated after v2.6.0-0.0.pre.'
  )
  Color? primaryVariant,
  @Deprecated(
    'Use secondary or secondaryContainer instead. '
    'This feature was deprecated after v2.6.0-0.0.pre.'
  )
  Color? secondaryVariant,
}) {
  return ColorScheme(
    brightness: brightness ?? this.brightness,
    primary : primary ?? this.primary,
    onPrimary : onPrimary ?? this.onPrimary,
    primaryContainer : primaryContainer ?? this.primaryContainer,
    onPrimaryContainer : onPrimaryContainer ?? this.onPrimaryContainer,
    secondary : secondary ?? this.secondary,
    onSecondary : onSecondary ?? this.onSecondary,
    secondaryContainer : secondaryContainer ?? this.secondaryContainer,
    onSecondaryContainer : onSecondaryContainer ?? this.onSecondaryContainer,
    tertiary : tertiary ?? this.tertiary,
    onTertiary : onTertiary ?? this.onTertiary,
    tertiaryContainer : tertiaryContainer ?? this.tertiaryContainer,
    onTertiaryContainer : onTertiaryContainer ?? this.onTertiaryContainer,
    error : error ?? this.error,
    onError : onError ?? this.onError,
    errorContainer : errorContainer ?? this.errorContainer,
    onErrorContainer : onErrorContainer ?? this.onErrorContainer,
    background : background ?? this.background,
    onBackground : onBackground ?? this.onBackground,
    surface : surface ?? this.surface,
    onSurface : onSurface ?? this.onSurface,
    surfaceVariant : surfaceVariant ?? this.surfaceVariant,
    onSurfaceVariant : onSurfaceVariant ?? this.onSurfaceVariant,
    outline : outline ?? this.outline,
    shadow : shadow ?? this.shadow,
    inverseSurface : inverseSurface ?? this.inverseSurface,
    onInverseSurface : onInverseSurface ?? this.onInverseSurface,
    inversePrimary : inversePrimary ?? this.inversePrimary,
    primaryVariant: primaryVariant ?? this.primaryVariant,
    secondaryVariant: secondaryVariant ?? this.secondaryVariant,
    surfaceTint: _surfaceTint ?? this.surfaceTint,
  );
}