getCurrentState method

Future<CustomerCurrentState> getCurrentState()

Implementation

Future<CustomerCurrentState> getCurrentState() async {
  AppResponse<String> profileResponse = await profileDatabase.getCurrent();
  if (profileResponse.isSuccess) {
    var response = await customerRepository.read(profileResponse.data);
    if (response.isSuccess) {
      return CustomerCurrentLoadedState(response.data);
    } else {
      return CustomerCurrentErrorState(response.error);
    }
  } else {
    return CustomerCurrentErrorState(profileResponse.error);
  }
}