KonectarEvents/lib/utils/validations.dart

51 lines
1.1 KiB
Dart
Raw Permalink Normal View History

2024-09-06 06:30:31 +00:00
import 'package:konectar_events/utils/constants.dart';
class FieldValidation {
static String validateEmail(String email) {
if (email.isEmpty) {
return 'Please enter email';
} else if (!email.isValidEmail()) {
return 'Please enter valid email';
} else {
return '';
}
}
static String validateMeetingId(String meetingId) {
if (meetingId.isEmpty) {
return 'Please enter meeting id or url';
} else {
return '';
}
}
static String validateName(String name) {
if (name.isEmpty) {
return 'Please enter name';
} else {
return '';
}
}
static String validateSecretKey(String domain) {
if (domain.isEmpty) {
2024-10-07 12:45:45 +00:00
return 'Please enter code';
2024-09-06 06:30:31 +00:00
} else {
return '';
}
}
static String validateUrl(String url) {
if (url.isEmpty) {
return 'Please enter application url';
} else {
bool isURLValid = Uri.parse(url).host.isNotEmpty;
if (isURLValid) {
return '';
} else {
return 'Please enter valid application url';
}
}
}
}