$new static method

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

Implementation

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