toNumInt property

int get toNumInt

转为int类型

Implementation

int get toNumInt {
  if (this == null) {
    return 0;
  }
  try {
    if (this is num) {
      return (this ?? 0) ~/ 1;
    } else {
      return (num.tryParse("$this") ?? 0) ~/ 1;
    }
  } catch (e) {
    return 0;
  }
}