copyWith method Null safety

SwitchThemeData copyWith(
  1. {MaterialStateProperty<Color?>? thumbColor,
  2. MaterialStateProperty<Color?>? trackColor,
  3. MaterialTapTargetSize? materialTapTargetSize,
  4. MaterialStateProperty<MouseCursor?>? mouseCursor,
  5. MaterialStateProperty<Color?>? overlayColor,
  6. double? splashRadius}
)

Creates a copy of this object but with the given fields replaced with the new values.

Implementation

SwitchThemeData copyWith({
  MaterialStateProperty<Color?>? thumbColor,
  MaterialStateProperty<Color?>? trackColor,
  MaterialTapTargetSize? materialTapTargetSize,
  MaterialStateProperty<MouseCursor?>? mouseCursor,
  MaterialStateProperty<Color?>? overlayColor,
  double? splashRadius,
}) {
  return SwitchThemeData(
    thumbColor: thumbColor ?? this.thumbColor,
    trackColor: trackColor ?? this.trackColor,
    materialTapTargetSize: materialTapTargetSize ?? this.materialTapTargetSize,
    mouseCursor: mouseCursor ?? this.mouseCursor,
    overlayColor: overlayColor ?? this.overlayColor,
    splashRadius: splashRadius ?? this.splashRadius,
  );
}