

The home page is having two buttons: Jokes and Products.Let's make a dummy design for all 4 pages: Home, Jokes, Products, and Favourite.Main.dart: Entry point of the application. Routes: Contains application routing files. In our example, we will be having 4 main features: home, joke, products, and favorites. Convert the response into a custom Dart object.

Send data to a server using the http package. Here is the project structure which we are going to follow during this example.Ĭore: Contains core application files such as constants, DIO client, shared preferences, etc.įeatures: Contains a specific feature of an application. This recipe uses the following steps: Add the http package. If you want, you can start along with me using this project, as it has all the dependencies already installed and set up.
#Flutter provider http request how to
In the first example, we will be using a Joke API to demonstrate how to make an API call using Riverpod. There are 2 API that we will use to create our example.

In this blog, we will be putting all the things that we learned from the last two articles into the play and we will be creating two examples. We have discussed what Riverpod is and how it works, so if you haven't had a chance to read those posts, make sure to check them out first. If you have been following my Riverpod series, you know that we have covered a wide range of concepts related to this state management. Welcome to my blog! In this blog, we will be exploring how to make an API call using Riverpod.
