isChineseOnly static method

bool isChineseOnly(
  1. String? text
)

验证是否只包含中文

Implementation

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