deleteBill method Null safety

Future<ApiResponse<String>> deleteBill(
  1. String paymentCode

Delete an existing bill at WeBirr Servers, if the bill is not paid yet. paymentCode is the number that WeBirr Payment Gateway returns on createBill. Check if(ApiResponse.error == null) to see if there are errors. ApiResponse.res will have the value of "OK" on success.


Future<ApiResponse<String>> deleteBill(String paymentCode) async {
  var client = RetryClient(http.Client());
  try {
    var resp = await client.put(Uri.parse(

    if (resp.statusCode == 200) {
      var map = jsonDecode(resp.body) as Map<String, dynamic>;
      return ApiResponse<String>(
          error: map['error'], errorCode: map['errorCode'], res: map['res']);
    } else {
      return new ApiResponse<String>(
          error: 'http error ${resp.statusCode} ${resp.reasonPhrase}');
  } finally {