isNumericOnly static method

bool isNumericOnly(
  1. String? text
)

验证是否只包含数字

Implementation

static bool isNumericOnly(String? text) {
  if (text?.isEmpty ?? true) return false;
  final regex = RegExp(r'^[0-9]+$');
  return regex.hasMatch(text!);
}