copyWith method

ToolAnnotations copyWith({
  1. bool? destructiveHint,
  2. bool? idempotentHint,
  3. bool? openWorldHint,
  4. bool? readOnlyHint,
  5. String? title,
})

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

Implementation

ToolAnnotations copyWith({
  bool? destructiveHint,
  bool? idempotentHint,
  bool? openWorldHint,
  bool? readOnlyHint,
  String? title,
}) =>
    ToolAnnotations.fromJson({
      ...toJson(),
      if (destructiveHint != null) 'destructiveHint': $encode(destructiveHint),
      if (idempotentHint != null) 'idempotentHint': $encode(idempotentHint),
      if (openWorldHint != null) 'openWorldHint': $encode(openWorldHint),
      if (readOnlyHint != null) 'readOnlyHint': $encode(readOnlyHint),
      if (title != null) 'title': $encode(title),
    });