toObscuredEmail method

String toObscuredEmail({
  1. String obscureText = "*",
})

Implementation

String toObscuredEmail({String obscureText = "*"}) {
  if (contains("@")) {
    final splited = replaceAll(" ", "").split("@");
    final String first = splited.first.length > 3
        ? splited.first.substring(0, 3)
        : splited.first;
    final String last = splited.last.length > 5
        ? splited.last.substring(splited.last.length - 5, splited.last.length)
        : splited.last;
    return '$first$obscureText@$obscureText$last';
  }
  return this;
}