validateUid static method
Validates uid for login. Returns null if valid, CometChatCallsException if invalid.
Implementation
static CometChatCallsException? validateUid(String? uid) {
if (uid == null) {
return CometChatCallsException(
ErrorCodeConstants.codeUidNull,
ErrorMessageConstants.messageUserIdIsNull,
ErrorDetailConstants.detailUserIdCannotBeNullOrEmpty,
);
}
if (uid.trim().isEmpty) {
return CometChatCallsException(
ErrorCodeConstants.codeUidEmpty,
ErrorMessageConstants.messageUserIdEmpty,
ErrorDetailConstants.detailUserIdCannotBeNullOrEmpty,
);
}
if (CometChatCallsUtils.containsSpace(uid)) {
return CometChatCallsException(
ErrorCodeConstants.codeUidHasSpace,
ErrorMessageConstants.messageUserIdHasSpace,
ErrorDetailConstants.detailUserIdHasSpace,
);
}
return null;
}