hasValidEmail method

bool? hasValidEmail(
  1. String email
)

hasValidEmail Method Check the provide email is valid (means non Disposable) then it will return true else false

Example:

zain@gmail.com <- this is Valid email Domain

zain@mailinator.com <- this is Disposable

Implementation

bool? hasValidEmail(String email) {
  const at = '@';
  final domainItem = _loadDomainItem();
  final model = DomainModel.fromJson(domainItem);

  if (!email.contains(at)) {
    return false;
  }

  var domainName = email.split(at).last;

  if ((model.domainItems ?? []).contains(domainName)) {
    return false;
  }
  return true;
}