isInteger method

bool isInteger(
  1. String? s
)

验证是否为整数

Implementation

bool isInteger(String? s) {
  if (s == null || s.isEmpty) return false;
  const pattern = r'^-?\d+$';
  return hasMatch(s, pattern);
}