call method

dynamic call()

Implementation

dynamic call() {
  var f = object as Function;

  var a = parameters;
  if (a == null || a.isEmpty) {
    return f();
  } else if (a.length == 1) {
    return f(a[0]);
  } else if (a.length == 2) {
    return f(a[0], a[1]);
  } else if (a.length == 3) {
    return f(a[0], a[1], a[2]);
  } else if (a.length == 4) {
    return f(a[0], a[1], a[2], a[3]);
  } else if (a.length == 5) {
    return f(a[0], a[1], a[2], a[3], a[4]);
  } else if (a.length == 6) {
    return f(a[0], a[1], a[2], a[3], a[4], a[5]);
  } else if (a.length == 7) {
    return f(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
  } else if (a.length == 8) {
    return f(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);
  } else if (a.length == 9) {
    return f(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
  } else if (a.length == 10) {
    return f(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);
  } else {
    return null;
  }
}