genBucketId static method

String genBucketId(
  1. String email,
  2. String userId
)

Implementation

static String genBucketId(String email, String userId) {
  String replaceEmail = email.replaceAll(RegExp(r'[!@#$%^&*(),.?":{}|<>]'), "-");
  String bucketId = '$replaceEmail.$userId';
  if (HycopFactory.serverType == ServerType.appwrite) {
    // appwrite (bucketId is max 36 char)
    if (bucketId.length > 36) {
      return bucketId.substring(0, 36);
    }
  } else {
    // firebase
    if (replaceEmail.length > 30) {
      return "$replaceEmail.${userId.substring(0, 63 - replaceEmail.length)}";
    }
  }
  return bucketId;
}