louisld
louisld

Reputation: 335

Http request are very slow with flutter

When I make an http from flutter to my REST API it takes around 13s to get the result while when I make an http request from my browser it takes around 0.05s. I don't understand why the difference is so big.

Here is my code for the http request :

import 'package:http/http.dart' show Client;

var time1 = DateTime.now().millisecondsSinceEpoch;
final response = await client.get(url, headers: {"Accept": "application/json"});
print(DateTime.now().millisecondsSinceEpoch - time1); // Print about 13s

Upvotes: 10

Views: 8353

Answers (1)

stefanodecillis
stefanodecillis

Reputation: 190

The problem is about flutter itself and iOS. At the moment it's not fixed. You can follow the ticket already posted on their repo here

Upvotes: 2

Related Questions