Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between Flutter HTTP and Flutter Dio? [closed]

Tags:

flutter

I have api calls which needs header data and body data. I found two packages in the pub.dev

https://pub.dev/packages/http --> http https://pub.dev/packages/dio --> dio

Which of these packages has better performance and is good to use in flutter apps??

like image 916
fizik bata Avatar asked Apr 13 '20 12:04

fizik bata


People also ask

What is difference between HTTP and Dio?

What is Dio? Dio is a powerful HTTP client for dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout, etc. By comparing the http package with Dio, Dio provides an intuitive API for performing advanced network tasks with minimal effort.

What is Flutter Dio?

Dio package comes handy as it provides a powerful HTTP client for Dart and Flutter and it supports Interceptors, Global configuration, FormData, Request Cancellation, File Downloading, Timeout etc. Also less boilerplate leads to cleaner code.

What is HTTP in Flutter?

Introduction. Applications frequently need to perform POST and GET and other HTTP requests. Flutter provides an http package that supports making HTTP requests. In this article, you will create an example Flutter app that uses the http package to perform HTTP requests to display placeholder information.

How do I cancel my Dio request Flutter?

You can cancel a request by using a cancel token. One token can be shared with different requests. when a token's cancel method invoked, all requests with this token will be cancelled.


2 Answers

You can use whatever, dio is more complete. It depends your need. But the performance are equivalent.

like image 89
woprandi Avatar answered Oct 18 '22 03:10

woprandi


on reddit people recommend http and i agree with them. it's simple

like image 1
Adam Smaka Avatar answered Oct 18 '22 03:10

Adam Smaka