initAccountModel method

Future initAccountModel()

Implementation

Future initAccountModel() async {
  var uidPhone = Common.getUidPhone();
  var phone = Common.getPhoneNumber();
  if (uidPhone.isEmpty || phone.isEmpty) return;
  if (kDebugMode) {
    print('initAccountModel with uid:$uidPhone');
  }
  if (uidPhone == '') return;
  try {
    await db
        .child('tblAccount/$uidPhone')
        .set({'phone': phone, 'uidPhone': uidPhone}).then((value) async {
      if (kDebugMode) {
        print('==========Thành công==========');
      }
      //create account if not exists
    });
  } catch (e) {
    LogController.setLog(
        log: e.toString(), titleLog: 'AuthController.initAccountModel');
    if (kDebugMode) {
      print('Error $e');
    }
  }

  await SQLService.createAccountIfNotExists(phone, uidPhone);
}