$tryParse static method

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

Wrapper of num.tryParse

Implementation

static $Value $tryParse(Runtime runtime, $Value? target, List<$Value?> args) {
  final source = args[0]!.$value as String;
  final result = num.tryParse(source);
  if (result == null) {
    return $null();
  }
  if (result is int) {
    return $int(result);
  }
  if (result is double) {
    return $double(result);
  }
  throw UnimplementedError();
}