validate method
Метод проверяет валидность данных
Implementation
@override
void validate() {
for (int i = 0; i < items.length; i++) {
items[i].validate();
}
final String? _email = email;
final String? _phone = phone;
if (_email != null || _phone != null) {
assert((_email != null) ^ (_phone != null));
if (_email != null) {
final bool match =
RegExp(r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')
.hasMatch(_email);
assert(_email.length <= 100 && match);
}
if (_phone != null) {
final bool match = RegExp(r'^\+[0-9](?:[\d]*)$').hasMatch(_phone);
assert(_phone.length <= 19 && match);
}
}
final String? _emailCompany = emailCompany;
if (_emailCompany != null) {
final bool match =
RegExp(r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')
.hasMatch(_emailCompany);
assert(_emailCompany.length <= 100 && match);
}
}