copyWith method

CursorModel copyWith({
  1. Duration? blinkSpeed,
  2. CursorMode? mode,
  3. String? char,
  4. bool? blink,
  5. bool? focus,
  6. int? blinkTag,
  7. Style? style,
  8. Style? textStyle,
})

Creates a copy with the given fields replaced.

Implementation

CursorModel copyWith({
  Duration? blinkSpeed,
  CursorMode? mode,
  String? char,
  bool? blink,
  bool? focus,
  int? blinkTag,
  Style? style,
  Style? textStyle,
}) {
  // Copy internal state using a workaround since fields are final
  return CursorModel._internal(
    blinkSpeed: blinkSpeed ?? this.blinkSpeed,
    mode: mode ?? _mode,
    char: char ?? _char,
    id: _id,
    blink: blink ?? _blink,
    focus: focus ?? _focus,
    blinkTag: blinkTag ?? _blinkTag,
    style: style ?? this.style,
    textStyle: textStyle ?? this.textStyle,
  );
}