copyWith method

TextContent copyWith({
  1. Annotations? annotations,
  2. String? text,
  3. Map<String, Object?>? meta,
})

A copy with the given properties replaced; everything else, unknown keys included, is kept.

Implementation

TextContent copyWith({
  Annotations? annotations,
  String? text,
  Map<String, Object?>? meta,
}) =>
    TextContent.fromJson({
      ...toJson(),
      if (annotations != null) 'annotations': $encode(annotations),
      if (text != null) 'text': $encode(text),
      if (meta != null) '_meta': $encode(meta),
    });