isChineseLicensePlate static method

bool isChineseLicensePlate(
  1. String? plate
)

验证车牌号

Implementation

static bool isChineseLicensePlate(String? plate) {
  if (plate?.isEmpty ?? true) return false;

  // 普通车牌和新能源车牌
  final regex = RegExp(
      r'^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-Z0-9]{4}[A-Z0-9挂学警港澳]$|^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][0-9]{5}[DF]$');
  return regex.hasMatch(plate!);
}