from static method

ASTValueNum<num> from(
  1. dynamic o, {
  2. bool? negative,
})

Implementation

static ASTValueNum from(dynamic o, {bool? negative}) {
  if (o is int) {
    return ASTValueInt(o, negative: negative);
  } else if (o is double) {
    return ASTValueDouble(o, negative: negative);
  } else if (o is String) {
    return from(parseNum(o.trim()), negative: negative);
  }
  throw StateError("Can't parse number: $o");
}