isNumeric property

bool get isNumeric

判断是否为数字类型

Implementation

bool get isNumeric {
  if (this == null) {
    return false;
  }
  if (this is String) {
    var value = this as String;
    return double.tryParse(value) != null;
  } else if (this is num) {
    return true;
  }
  return false;
}