setUserMobile static method

Future<void> setUserMobile(
  1. String userId,
  2. String mobile
)

Implementation

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

  //set user id
  await _setUserId(userId);

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

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

  //Check for currently set user id
  User user = User(userId: userId, mobile: mobile);
  await UpdateUserController().start(Prefs.getString(PREF_APP_ID, null)!, user);
}