I'm trying to understand the difference between the http package and the HttpClient class in the dart:io library. My purpose is to known when I should use which. I see both of them used to apparently do the same thing.
I've seen these Q&As:
- Choosing between package:html, dart:html, dart:io (class HttpClient) and package:http APIs to fetch HTTP resources
- How to make HTTPS request using HttpClient in dart?
- In a Dart console application, is there a library for an HTTP Request that doesnt require DOM access?
- How to do POST in Dart command line HttpClient
This is what I think is true so far but my understanding is fuzzy:
http
is high level andHttpClient
is low level (source)http
can make post requests butHttpClient
can't (source)- both
http
andHttpClient
(withHttpClientRequest
) can make GET and POST requests (source) - both
http
andHttpClient
can be used on the client and the server
So to sum it up, I would say that each one can do anything that the other can as well, but it is easier to use the http
package since this one is more high-level. Is that summary correct?