getAddressByCep method

Future<ApiCallback<AddressCep>> getAddressByCep(
  1. String cep
)

Implementation

Future<ApiCallback<AddressCep>> getAddressByCep(String cep) async {
  try {
    // Update the item
    var response = await _requester.get(API_ADDRESS_BY_CEP.replaceAll("%", cep),
        options: Options(responseType: ResponseType.json));
    // Callback invocation
    return ApiCallback<AddressCep>(
        isSuccessful: true, resultData: AddressCep.fromJson(response.data));
  } on DioError catch (e) {
    return ApiCallback<AddressCep>().defaultErrorCallback(e);
  }
}