getSchoolInfoFromServer method

Future<TCICGetSchoolInfoRepModel?> getSchoolInfoFromServer()

Implementation

Future<TCICGetSchoolInfoRepModel?> getSchoolInfoFromServer() async {
  print("【【【【getSchoolInfoFromServer");
  await sharedPreferencesFuture;
  final cacheData = sharedPreferences.getString("tcic-schoolInfo");
  if (cacheData != null) {
    TCICLog.info(
      "getSchoolInfoFromCache",
      actionModule: ActionModule.tcicController.name,
      actionName: ActionName.getSchoolInfo.name,
    );
    final cacheSchoolInfo = TCICGetSchoolInfoRepModel.fromJson(
      json.decode(cacheData),
    );
    _schoolInfoObs.updateSchoolInfo(cacheSchoolInfo);
    _eventbus.fire(
      MainEvent(
        type: EventTypeEnum.getSchoolInfoSuccess,
        data: cacheSchoolInfo,
      ),
    );
    getSchoolInfoAsync(
      cacheSchoolInfo: cacheSchoolInfo,
      needFireEvent: false,
    );
    return cacheSchoolInfo;
  }
  return await getSchoolInfoAsync();
}