updateGroupRequestValidator function
void
updateGroupRequestValidator()
Implementation
void updateGroupRequestValidator(
String chatId,
String groupName,
String groupDescription,
String? groupImage,
List<String> members,
List<String> admins,
String address,
) {
if (chatId.isEmpty) {
throw Exception('chatId cannot be null or empty');
}
if (groupName.isEmpty) {
throw Exception('groupName cannot be null or empty');
}
if (groupName.length > 50) {
throw Exception('groupName cannot be more than 50 characters');
}
if (groupDescription.length > 150) {
throw Exception('groupDescription cannot be more than 150 characters');
}
if (members.isNotEmpty) {
for (int i = 0; i < members.length; i++) {
if (!isValidETHAddress(members[i])) {
throw Exception('Invalid member address in members list!');
}
}
}
if (admins.isNotEmpty) {
for (int i = 0; i < admins.length; i++) {
if (!isValidETHAddress(admins[i])) {
throw Exception('Invalid member address in admins list!');
}
}
}
if (!isValidETHAddress(address)) {
throw Exception('Invalid address field!');
}
}