validateRegion static method

CometChatCallsException? validateRegion(
  1. String? region
)

Validates region for SDK initialization. Returns null if valid, CometChatCallsException if invalid.

Implementation

static CometChatCallsException? validateRegion(String? region) {
  if (region == null) {
    return CometChatCallsException(
      ErrorCodeConstants.codeRegionNull,
      ErrorMessageConstants.messageRegionIsNull,
      ErrorDetailConstants.detailRegionIsNull,
    );
  }
  if (region.trim().isEmpty) {
    return CometChatCallsException(
      ErrorCodeConstants.codeRegionEmpty,
      ErrorMessageConstants.messageRegionEmpty,
      ErrorDetailConstants.detailRegionEmpty,
    );
  }
  return null;
}