Questions tagged [flutter-http]
241 questions
0
votes
1 answer
Flutter connection timed out error on real device
My flutter app is running absolutely fine on Emulators and Simulators but when running on a real device, it is showing me Connection Timeout errors. Not sure what the issue is. Please note that the api is already hosted and I am not using localhost.…

Shrijan Regmi
- 450
- 5
- 10
0
votes
1 answer
flutter Restful API Call Error: Expected a value 'Map',but got one of type 'String'
I am newbie of flutter
I want to load some data from my restful API by using Yii2
Provide data to API: { "account":"B0929036", "password":"12344567" } ........(more account and password)
API return data: [ {…

Chavon
- 1
0
votes
0 answers
Flutter : send image file to server
in postman
in Body -> from-data i have key = image and value file of image
and type of key is File
in Authorization i have Bearer Token and send token
in header i have Content-Type = multipart/form-data; boundary=
and a url is 'url/id'
when i send…

user17838882
- 93
- 2
- 14
0
votes
1 answer
How to validate date and time on the client side like Chrome does, using Flutter Web
I have a Flutter Web application, and I want to validate the date and time of the Client side, just like Chrome or Whatsapp does. To do this, I decided to send in each request the current date and time within the headers, and validate it on the…

ldiaz997
- 128
- 8
0
votes
0 answers
net: ERR_CERT_COMMON_NAME_INVALID in API call using Flutter web
I am trying to call an https connection in flutter web,
import 'package:http/http.dart' as http;
Map requestHeaders = {
'Content-type': 'application/json',
'Api-key': 'ab1234-98765xyz',
'Authorization-key':…

Faiz Anwar
- 658
- 2
- 9
- 18
0
votes
1 answer
Flutter Login type 'int' is not a subtype of type 'String'
This is my file user_model.dart
class UserModel {
int id, nik;
String password, token;
UserModel(
{required this.id,
required this.nik,
required this.password,
required this.token});
factory…

Asadin
- 1
0
votes
1 answer
Error: type 'List' is not a subtype of type 'String' in Flutter
I'm learning to fetch a data from an API using mockapi.
I followed the flutter examples using the HTTP package but there's something wrong with the code and I can't seem to figure it out.
I have tried several APIs the one with headers and the one…

The Minxs
- 3
- 2
0
votes
0 answers
When requesting the OpenAI API in Flutter on a Windows environment, an error message "The semaphore timeout period has expired" is returned
I receive an error message from Flutter saying :
"The semaphore timeout period has expired".
However, it returns results normally in Chrome and Android.
I have been searching for solutions for a long time but haven't been able to solve it.
Below…

isYang
- 1
- 1
0
votes
0 answers
No matching calls when verify a call in unit test
I want to unit test and check a method makes correct http request. So I create the bellow test:
class MockRequest extends Mock implements http.Request {}
then
test('make correct http request', () async {
final uri =…

zex_rectooor
- 692
- 7
- 26
0
votes
1 answer
Problem receiving information / Exception has occurred TypeError
I want to read my information from the API. But facing this error.
This is the code I wrote:
import '../models/LocationListApi.dart';
import 'package:http/http.dart' as http;
import 'dart:convert' as convert;
class Network {
static Uri url =…

AmirSam
- 25
- 6
0
votes
3 answers
fetching data from api and pass it to next page but showing error
//sign() fnction is in statless widget
var y
y=signIn();
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => posting(y),
),
…

suman singh
- 13
- 3
0
votes
0 answers
How to post FormData using http package in Flutter, with multiple file with multiple key?
I have to Post Multipart Data using http package with multiple files with "files" key, every file have own "files" key like bellow.
here entityDTOString is data and files are files which is picked, If I pick 3 files then there is 3 files key and…

Dhaval Chaudhari
- 417
- 8
- 22
0
votes
1 answer
Http package refused connection on mobile network many time but on wifi works fine after updating http package
My whole team face this problem in our retailer app API works slowly on mobile network but on Wi-Fi works superb. It is not API problem http package have some kind of issue. please help to rectify this problem as much as…
0
votes
2 answers
Why can I use print my API response on a button press but not display it as a widget in Flutter? And how do I fix it?
In my Flutter App, I am trying to call an API in initState and I am able to successfully get a response in the format that I want. I know this because when I try and print the variable on a button press, I get the correct response. However, when I…

user15312648
- 61
- 6
0
votes
0 answers
Connection closed error and error handling in Flutter
I get an unhandled exception error at times, and at other times, it works just fine. Not sure what is causing this issue. What I understand from my limited understanding is that it sends a async request awaiting a response. And before the response…

Saad Bashir
- 4,341
- 8
- 30
- 60