Questions tagged [flutter-http]

241 questions
0
votes
1 answer

having trouble sending json data via http.get() request in flutter

I am working on a flutter project, and I am trying to call a django based web-api, to retrieve posts that are relevant to a user in some way. Now my web-api works fine when I test it in outside of flutter app. I am able to sign-in, sign-up, thus I…
0
votes
1 answer

Flutter physical iOS device unable to make api request to my local asp.net server

When I debug my app from a physical iOS device and try to make a request to my local server, I get this error that I don't get on the iOS simulator: SocketException (SocketException: OS Error: Connection refused, errno = 61, address =…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
1 answer

How to sort a Future data type on DataTable widget in Flutter?

I have a problem for sorting a list from Future data type in DataTable widget class User { final String idUser, name, phone; User( {this.idUser, this.name, this.phone}); factory User.fromJson(Map json) { …
Alfan
  • 19
  • 5
0
votes
1 answer

After posting backend responding a token . Now how will get that that token? flutter http request

After log in backend responding a token. Now how will get that that token? I used HTTP package for this project. I am new to flutter. my code example: Future login() async { if (_password.text.isNotEmpty && _number.text.isNotEmpty) { …
Romanch haque
  • 84
  • 1
  • 10
0
votes
1 answer

StreamBuilder: A non-null value must be returned since the return type 'Stream' doesn't allow null

I'm using a StreamBuilder widget to show the score in real-time (fetching the data from API and then passing it to the stream) but while doing this process, it is throwing up the following error "A non-null value must be returned since the return…
shakky
  • 434
  • 5
  • 20
0
votes
1 answer

FutureBuilder not populating value

In my main.dart I have an async function to get data from an URL. getShopLength() async { final queryParameters = { 'api_key': '123', 'user_id': '123', 'lat': '123', 'long': '123', 'km': '123', }; var response = await…
piguy
  • 516
  • 3
  • 10
  • 30
0
votes
1 answer

Error: Expected a value of type 'String', but got one of type 'Null'

I am learing about api's and http request in flutter and I got an error in making a get request I got this error : Error: Expected a value of type 'String', but got one of type 'Null' enter image description here I got this error: enter image…
francesco
  • 1
  • 2
0
votes
0 answers

Flutter GetX Provider & GetConnect Settings

I created a Flutter project with GetX CLI. Then i created a provider with get generate model. But i have problems with provider: When i bind it with lazyPut, onInit() never works. When i bind it with put, onInit() works but…
LacOniC
  • 824
  • 12
  • 21
0
votes
1 answer

How to make a list from a class that the class need data from several database?

I have a problem to load a list from a class that the class need data from several database The database: A. userdata (_id, name, phone) B. mariage status (_id, userID, mariageStatus) --> "_id" in userdata & "userID" in marriage status are thing to…
Alfan
  • 19
  • 5
0
votes
1 answer

Flutter does not handle http redirect correctly

Hi I have the following problem in flutter. I make a post http request and in the browser the website returns status 302, with the location of the redirect in the header of the response called "location", so far so good. But when I make the request…
0
votes
1 answer

Fetch Data from a Wix Database through http request

I created a database with Wix that has several different types of content like Strings, images, addresses and more.I want to use the information from the WIX database for an app(made with Flutter and Dart); simply portraying the information in a…
Dee Jott
  • 125
  • 1
  • 2
  • 12
0
votes
3 answers

Common method for flutter api calls

Is there any example that I can refer to about Common class/method for flutter API calls(GET,POST,...) in flutter? I have handled all the API requests in a common method in react native, I'm not sure how to implement it in flutter.
0
votes
2 answers

Flutter - String that contains token is stored and return with leading slash and quotes. How to remove them?

I am using Laravel for my back end and Flutter for my front end. When the token is stored, I use my local storage: localStorage.setString('token',json.encode(body['access_token'])); This works fine. The token is stored as expected. But when I try to…
Daco
  • 1
  • 2
0
votes
2 answers

API call to Flask API works from Postman and fails from Flutter

EDIT: Posted fix in comments below- was using Postman incorrectly The call works successfully in postman, but fails from my flutter application. In postman, I include the following key, value in "Body" key:…
Jonah Kornberg
  • 153
  • 1
  • 8
0
votes
1 answer

I cant send image to api in flutter

this is my upload function void upload() async { print("inside upload image"); if (file == null) return; String base64 = base64Encode(file.readAsBytesSync()); String imagename = file.path.split("/").last; dynamic data =…