UserPhone constructor

UserPhone(
  1. String value
)

Implementation

UserPhone(String value) : super(value.trim()) {
  if (!val.startsWith('+')) {
    throw const FormatException('Must start with plus');
  }

  if (val.length < 8) {
    throw const FormatException('Must contain no less than 8 symbols');
  }

  if (!_regExp.hasMatch(val)) {
    throw FormatException('Does not match validation RegExp: `$val`');
  }
}