CompareTo constructor

CompareTo()

Implementation

CompareTo()
  : super(
      methodName: "compareTo",
      targetType: NativeMethodTarget.number,
      arity: 1,
      function: (target, interpreter, arguments) {
        if (arguments[0] is! num) {
          throw RuntimeError("Argument must be a number.");
        }
        return target.compareTo(arguments[0]);
      },
    );