setUserEmail static method

Future<void> setUserEmail(
  1. String userId,
  2. String email
)

Implementation

static Future<void> setUserEmail(String userId, String email) async {
  //throws exception if uninitialized
  _checkIfSDKInitialized();

  //set user id
  await _setUserId(userId);

  if (email.isEmpty || userId.isEmpty) {
    return;
  }

  //check if cached mobile is same as the argument
  User? currentUser = getCurrentUser();
  if (currentUser?.email == email) {
    return;
  }

  User user = User(userId: userId, email: email);
  await UpdateUserController().start(Prefs.getString(PREF_APP_ID, null)!, user);
}