copyWith method

ResourceLink copyWith({
  1. Map<String, Object?>? meta,
  2. Annotations? annotations,
  3. String? description,
  4. String? mimeType,
  5. String? name,
  6. int? size,
  7. String? title,
  8. String? uri,
  9. List<McpIcon>? icons,
})

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

Implementation

ResourceLink copyWith({
  Map<String, Object?>? meta,
  Annotations? annotations,
  String? description,
  String? mimeType,
  String? name,
  int? size,
  String? title,
  String? uri,
  List<McpIcon>? icons,
}) =>
    ResourceLink.fromJson({
      ...toJson(),
      if (meta != null) '_meta': $encode(meta),
      if (annotations != null) 'annotations': $encode(annotations),
      if (description != null) 'description': $encode(description),
      if (mimeType != null) 'mimeType': $encode(mimeType),
      if (name != null) 'name': $encode(name),
      if (size != null) 'size': $encode(size),
      if (title != null) 'title': $encode(title),
      if (uri != null) 'uri': $encode(uri),
      if (icons != null) 'icons': $encode(icons),
    });