phoneDesensitized property
String
phoneDesensitized
Mobile phone number desensitization.
E.g : 18801210281 -> 188****0281
Implementation
String get phoneDesensitized {
assert(isNotEmpty, 'The length of the phone number cannot be empty.');
String phone = replaceAll(' ', '');
assert(phone.length == 11,
'The length of the mobile phone number is illegal, the legal length is 11.');
return phone.replaceRange(3, 7, '*' * 4);
}