copyWith method Null safety

InputDecoration copyWith(
  1. {Widget? icon,
  2. Widget? label,
  3. String? labelText,
  4. TextStyle? labelStyle,
  5. TextStyle? floatingLabelStyle,
  6. String? helperText,
  7. TextStyle? helperStyle,
  8. int? helperMaxLines,
  9. String? hintText,
  10. TextStyle? hintStyle,
  11. TextDirection? hintTextDirection,
  12. int? hintMaxLines,
  13. String? errorText,
  14. TextStyle? errorStyle,
  15. int? errorMaxLines,
  16. FloatingLabelBehavior? floatingLabelBehavior,
  17. bool? isCollapsed,
  18. bool? isDense,
  19. EdgeInsetsGeometry? contentPadding,
  20. Widget? prefixIcon,
  21. Widget? prefix,
  22. String? prefixText,
  23. BoxConstraints? prefixIconConstraints,
  24. TextStyle? prefixStyle,
  25. Widget? suffixIcon,
  26. Widget? suffix,
  27. String? suffixText,
  28. TextStyle? suffixStyle,
  29. BoxConstraints? suffixIconConstraints,
  30. Widget? counter,
  31. String? counterText,
  32. TextStyle? counterStyle,
  33. bool? filled,
  34. Color? fillColor,
  35. Color? focusColor,
  36. Color? hoverColor,
  37. InputBorder? errorBorder,
  38. InputBorder? focusedBorder,
  39. InputBorder? focusedErrorBorder,
  40. InputBorder? disabledBorder,
  41. InputBorder? enabledBorder,
  42. InputBorder? border,
  43. bool? enabled,
  44. String? semanticCounterText,
  45. bool? alignLabelWithHint,
  46. BoxConstraints? constraints}
)

Creates a copy of this input decoration with the given fields replaced by the new values.

Implementation

InputDecoration copyWith({
  Widget? icon,
  Widget? label,
  String? labelText,
  TextStyle? labelStyle,
  TextStyle? floatingLabelStyle,
  String? helperText,
  TextStyle? helperStyle,
  int? helperMaxLines,
  String? hintText,
  TextStyle? hintStyle,
  TextDirection? hintTextDirection,
  int? hintMaxLines,
  String? errorText,
  TextStyle? errorStyle,
  int? errorMaxLines,
  FloatingLabelBehavior? floatingLabelBehavior,
  bool? isCollapsed,
  bool? isDense,
  EdgeInsetsGeometry? contentPadding,
  Widget? prefixIcon,
  Widget? prefix,
  String? prefixText,
  BoxConstraints? prefixIconConstraints,
  TextStyle? prefixStyle,
  Widget? suffixIcon,
  Widget? suffix,
  String? suffixText,
  TextStyle? suffixStyle,
  BoxConstraints? suffixIconConstraints,
  Widget? counter,
  String? counterText,
  TextStyle? counterStyle,
  bool? filled,
  Color? fillColor,
  Color? focusColor,
  Color? hoverColor,
  InputBorder? errorBorder,
  InputBorder? focusedBorder,
  InputBorder? focusedErrorBorder,
  InputBorder? disabledBorder,
  InputBorder? enabledBorder,
  InputBorder? border,
  bool? enabled,
  String? semanticCounterText,
  bool? alignLabelWithHint,
  BoxConstraints? constraints,
}) {
  return InputDecoration(
    icon: icon ?? this.icon,
    label: label ?? this.label,
    labelText: labelText ?? this.labelText,
    labelStyle: labelStyle ?? this.labelStyle,
    floatingLabelStyle: floatingLabelStyle ?? this.floatingLabelStyle,
    helperText: helperText ?? this.helperText,
    helperStyle: helperStyle ?? this.helperStyle,
    helperMaxLines : helperMaxLines ?? this.helperMaxLines,
    hintText: hintText ?? this.hintText,
    hintStyle: hintStyle ?? this.hintStyle,
    hintTextDirection: hintTextDirection ?? this.hintTextDirection,
    hintMaxLines: hintMaxLines ?? this.hintMaxLines,
    errorText: errorText ?? this.errorText,
    errorStyle: errorStyle ?? this.errorStyle,
    errorMaxLines: errorMaxLines ?? this.errorMaxLines,
    floatingLabelBehavior: floatingLabelBehavior ?? this.floatingLabelBehavior,
    isCollapsed: isCollapsed ?? this.isCollapsed,
    isDense: isDense ?? this.isDense,
    contentPadding: contentPadding ?? this.contentPadding,
    prefixIcon: prefixIcon ?? this.prefixIcon,
    prefix: prefix ?? this.prefix,
    prefixText: prefixText ?? this.prefixText,
    prefixStyle: prefixStyle ?? this.prefixStyle,
    prefixIconConstraints: prefixIconConstraints ?? this.prefixIconConstraints,
    suffixIcon: suffixIcon ?? this.suffixIcon,
    suffix: suffix ?? this.suffix,
    suffixText: suffixText ?? this.suffixText,
    suffixStyle: suffixStyle ?? this.suffixStyle,
    suffixIconConstraints: suffixIconConstraints ?? this.suffixIconConstraints,
    counter: counter ?? this.counter,
    counterText: counterText ?? this.counterText,
    counterStyle: counterStyle ?? this.counterStyle,
    filled: filled ?? this.filled,
    fillColor: fillColor ?? this.fillColor,
    focusColor: focusColor ?? this.focusColor,
    hoverColor: hoverColor ?? this.hoverColor,
    errorBorder: errorBorder ?? this.errorBorder,
    focusedBorder: focusedBorder ?? this.focusedBorder,
    focusedErrorBorder: focusedErrorBorder ?? this.focusedErrorBorder,
    disabledBorder: disabledBorder ?? this.disabledBorder,
    enabledBorder: enabledBorder ?? this.enabledBorder,
    border: border ?? this.border,
    enabled: enabled ?? this.enabled,
    semanticCounterText: semanticCounterText ?? this.semanticCounterText,
    alignLabelWithHint: alignLabelWithHint ?? this.alignLabelWithHint,
    constraints: constraints ?? this.constraints,
  );
}