parseIntWithDefault property

int get parseIntWithDefault

解析为 int,失败或 null 返回 0。

Implementation

int get parseIntWithDefault {
  final s = this;
  if (s == null) return 0;
  final parseInt = int.tryParse(s);
  return parseInt ?? 0;
}