callMethod method

dynamic callMethod(
  1. JSObject obj,
  2. String method,
  3. List args
)

Implementation

dynamic callMethod(JSObject obj, String method, List<dynamic> args) {
  switch (args.length) {
    case 0:
      return callMethod0(obj, method);
    case 1:
      return callMethod1(obj, method, args[0]);
    case 2:
      return callMethod2(obj, method, args[0], args[1]);
    default:
      // For 3+ arguments, fall back to VarArgs if needed
      // Note: the cast does not work properly at the moment
      return obj.callMethodVarArgs(method.toJS, args.cast<JSAny?>());
  }
}