hideIdCard static method

String hideIdCard(
  1. String phone, {
  2. int start = 3,
  3. int end = 15,
  4. String replace = '*',
})

隐藏身份证码 Hide part of id card

Implementation

static String hideIdCard(String phone, {int start = 3, int end = 15, String replace = '*'}) {
  if (phone.length < 18) return phone;
  return phone.replaceRange(start, end, replace * (end - start));
}