DELETE-ing data
In this recipe, you will learn how to perform a DELETE action on a web service. This is useful when your apps need to delete existing data from a web service.
Getting ready
To follow along with this recipe, you must have completed the code in the previous recipe.
How to do it...
To perform a DELETE action on a web service, follow these steps:
- Log in to the Wiremock service at https://app.wiremock.cloud and click on the
Stubssection of the example API. Then, create a new stub. - Complete the request, with the following data:
- Name:
Delete Pizza - Verb:
DELETE - Address:
/pizza - Status:
200 - Body Type:
json - Body:
{"message": "Pizza was deleted"}
- Name:
- Save the new stub.
- In the Flutter project, add a
deletePizzamethod to theHttpHelperclass in thehttp_helper.dartfile:Future<String> deletePizza(int id) async { const deletePath...