copyWith method

TextElement copyWith({
  1. String? text,
  2. List<String?>? groups,
  3. Type? matcherType,
  4. int? matcherIndex,
  5. int? offset,
})

Creates a new TextElement from this one by updating individual properties.

This method creates a new TextElement object with values for the properties provided by similarly named arguments, or using the existing value of the property if no argument, or null, is provided.

Implementation

TextElement copyWith({
  String? text,
  List<String?>? groups,
  Type? matcherType,
  int? matcherIndex,
  int? offset,
}) {
  return TextElement(
    text ?? this.text,
    groups: groups ?? this.groups,
    matcherType: matcherType ?? this.matcherType,
    matcherIndex: matcherIndex ?? this.matcherIndex,
    offset: offset ?? this.offset,
  );
}