copyWith method

CacheableResult copyWith({
  1. ResultMetaObject? meta,
  2. CacheableResultCacheScope? cacheScope,
  3. String? resultType,
  4. int? ttlMs,
})

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

Implementation

CacheableResult copyWith({
  ResultMetaObject? meta,
  CacheableResultCacheScope? cacheScope,
  String? resultType,
  int? ttlMs,
}) =>
    CacheableResult.fromJson({
      ...toJson(),
      if (meta != null) '_meta': $encode(meta),
      if (cacheScope != null) 'cacheScope': $encode(cacheScope),
      if (resultType != null) 'resultType': $encode(resultType),
      if (ttlMs != null) 'ttlMs': $encode(ttlMs),
    });