castElement method

N castElement(
  1. num n
)

Implementation

N castElement(num n) {
  if (N == int) {
    return n.toInt() as N;
  } else {
    return n.toDouble() as N;
  }
}