isPositiveInteger method

bool isPositiveInteger(
  1. String? s
)

验证是否为正整数

Implementation

bool isPositiveInteger(String? s) {
  if (s == null || s.isEmpty) return false;
  const pattern = r'^[1-9]\d*$';
  return hasMatch(s, pattern);
}