copyWith method Null safety

TextEditingValue copyWith(
  1. {String? text,
  2. TextSelection? selection,
  3. TextRange? composing}
)

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

Implementation

TextEditingValue copyWith({
  String? text,
  TextSelection? selection,
  TextRange? composing,
}) {
  return TextEditingValue(
    text: text ?? this.text,
    selection: selection ?? this.selection,
    composing: composing ?? this.composing,
  );
}