toNumeric method

dynamic toNumeric(
  1. dynamic s
)

Implementation

toNumeric(s) {
  myLogAll('toNumeric');
  if (!isNumeric(s)) {
    //print('==== is not numeric $s');
    return s;
  }
  try {
    return int.parse(s);
  } catch (e) {
    //print('==== int parse fail $s');
    try {
      return double.parse(s);
    } catch (e1) {
//        print('==== double parse fail $s');
      return s;
    }
  }
}