getCurrentState method

Future<StoreCurrentState> getCurrentState()

Implementation

Future<StoreCurrentState> getCurrentState() async {
  AppResponse<String> profileResponse = await profileDatabase.getCurrent();
  if (profileResponse.isSuccess) {
    var response = await storeRepository.read(profileResponse.data);
    if (response.isSuccess) {
      return StoreCurrentLoadedState(response.data);
    } else {
      return StoreCurrentErrorState(response.error);
    }
  } else {
    return StoreCurrentErrorState(profileResponse.error);
  }
}