copyWith method

DiscoverResult copyWith({
  1. ResultMetaObject? meta,
  2. DiscoverResultCacheScope? cacheScope,
  3. ServerCapabilities? capabilities,
  4. String? instructions,
  5. String? resultType,
  6. List<String>? supportedVersions,
  7. int? ttlMs,
})

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

Implementation

DiscoverResult copyWith({
  ResultMetaObject? meta,
  DiscoverResultCacheScope? cacheScope,
  ServerCapabilities? capabilities,
  String? instructions,
  String? resultType,
  List<String>? supportedVersions,
  int? ttlMs,
}) =>
    DiscoverResult.fromJson({
      ...toJson(),
      if (meta != null) '_meta': $encode(meta),
      if (cacheScope != null) 'cacheScope': $encode(cacheScope),
      if (capabilities != null) 'capabilities': $encode(capabilities),
      if (instructions != null) 'instructions': $encode(instructions),
      if (resultType != null) 'resultType': $encode(resultType),
      if (supportedVersions != null) 'supportedVersions': $encode(supportedVersions),
      if (ttlMs != null) 'ttlMs': $encode(ttlMs),
    });