$new static method

$JsonCodec $new(
  1. Runtime runtime,
  2. $Value? target,
  3. List<$Value?> args
)

Implementation

static $JsonCodec $new(Runtime runtime, $Value? target, List<$Value?> args) {
  final reviver = args[0]?.$value as EvalCallable?;
  return $JsonCodec.wrap(JsonCodec(
      reviver: reviver == null
          ? null
          : (key, value) {
              return reviver.call(runtime, null, [
                runtime.wrapPrimitive(key) ?? key as $Value?,
                runtime.wrapPrimitive(value) ?? value as $Value?
              ])?.$value;
            }));
}