How to send path in Retrofit in flutter?

Updated 27 April 2023


In this blog, we will learn “how to send path in retrofit in flutter?”.

Before starting the code implementation, I am giving you a brief description of the blog topic.

Retrofit is the easiest way to call rest API’s in flutter. But it’s quite confusing to send path in retrofit.
I will make it clear in this blog.

Read more about Flutter app development from mobikul.


For sending path in retrofit in flutter, I am assuming that you have basic knowledge of simple API callings in retrofit.

Let’s start the code implementation.

Step 1:-Add dependencies

Add all the basic dependencies necessary for the retrofit method in the flutter.

In your pubspec.yaml file, add the following dependencies.

Step 2:-Code Impementation

As you know that all the APIs are added in the APiClient file in retrofit flutter.

Let’s add the path in the dummy API.

I am taking a dummy base URL and end URL. you can add your own.

Suppose we are sending the product id as the, we need to add the correct key of product id.

for example, here the key is “product_id” of product Id.

Step 3:-Run the command

now the following retrofit command in your terminal.

Retrofit flutter command needs to run after add API:–“flutter packages pub run build_runner build“.

Step 4:-OutPut after running the command

you will get the following output after the successful result of the command in the retrofit flutter.

Congratulations!!!! you have learned that how to send path in retrofit.

For more details and methods you can refer to the official doc of flutter here.

For more interesting blogs check out here –

Hope this blog helped you with a better understanding that how to send path in Retrofit in flutter?

Thanks for reading.😇

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home