copyWith method

Root copyWith({
  1. String? name,
  2. String? uri,
  3. Map<String, Object?>? meta,
})

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

Implementation

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