copyWith method

TextResourceContents copyWith({
  1. String? mimeType,
  2. String? text,
  3. String? uri,
  4. Map<String, Object?>? meta,
})

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

Implementation

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