Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Using dio HTTP Client in Dart

DEV Community·Mathieu K·18 days ago
#XZnwwMnk
#section#1250#dart#fullscreen#method#response
Reading 0:00
15s threshold

The low-level HTTP Client and a higher level implementation with the http package have been tested previously. This time, we will try another high level implementation of an HTTP client in Dart called dio . This client seems way more flexible than the previous clients, and embed great features. Furthermore, based on pub.dev, it looks like it's a popular choice. If you are interested to see some examples, you can look into example_dart/lib directory from their official repository . Anyway the first step to use it is to add it in the dependencies. dart pub add dio dart pub get Enter fullscreen mode Exit fullscreen mode This time, instead of of using our own quick and dirty HTTP server using netcat or Python http.server module , let use the free HTTP Echo Server service . The idea is to simply creates some requests to this server and print the data returned. As usual, the first step is to import the package in bin/httpcat.dart .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More