getLogin method

Future<Map<String, List<Map<String, Object?>?>?>?> getLogin()

Implementation

Future<Map<String, List<Map<String, Object?>?>?>?> getLogin() async {
  var uidPhone = Common.getUidPhone();
  var phone = Common.getPhoneNumber();
  if (uidPhone.isEmpty || phone.isEmpty) return null;
  if (kDebugMode) {
    print('getLogin uidPhone: $uidPhone , phone: $phone');
  }
  var rs = await SQLService.execute('sp_getLogin',
      params: {'phone': phone, 'uidPhone': uidPhone});

  var data = Methods.getList(rs, 'info');
  if (data.isNotEmpty) {
    String keyMessage = Methods.getString(data[0], 'messageId');
    if (keyMessage.isNotEmpty) {
      _widgetDialogThongBao(keyMessage: keyMessage);
    }
    String uidSever = Methods.getString(data[0], 'uidPhone');
    if (uidSever.isEmpty) {
      //dong bo uid phone
      await SQLService.createAccountIfNotExists(phone, uidPhone);
    }

    if (Methods.getInt(data[0], 'ID') > 0) {
      return rs;
    } else {
      return null;
    }
  }
  return rs;
}