checkRange function
Implementation
int checkRange(int orig, int converted) {
if (orig.isNaN || converted.isNaN || (!(orig is int) && !(orig is String))) {
throw 'Expected number';
}
if (orig != converted) {
throw 'Number is out of range';
}
return orig;
}