Questions tagged [dio]

Dio is a powerful HTTP client for Dart, which supports interceptors, global configuration, form data, request cancellation, file downloading, timeout, etc.

Dio is a powerful HTTP client for Dart, which supports interceptors, global configuration, form data, request cancellation, file downloading, timeout, etc.

References

Dio Dart package.

664 questions
9
votes
2 answers

Flutter Dio post an object with array

I am trying to post a request to api with an object as" var params = { "item": "itemx", "options": [1,2,3], }; print(params); try { Response response = await _dio.post(getAddToCartURL, queryParameters: params, …
Chosen
  • 847
  • 2
  • 9
  • 21
9
votes
4 answers

Flutter web http request badCertificateCallback

I was wondering if any you can point me to a web flutter library that had http badCertificateCallback. I tried DIO but it is giving me an error and submit an issue but I haven't heard from them yet DIO code: Dio dio = new…
Daniel Hernandez
  • 338
  • 3
  • 13
8
votes
4 answers

Upload Image/File to Strapi (Flutter Web)

I'm trying to upload an image to Strapi through Flutter Web. I'm aware (from this link) that I need to use FormData to do so. I've researched on many ways to do this and I stumble across Dio and of course Http. Both solutions gave me…
8
votes
3 answers

Handshake error in client : CERTIFICATE_VERIFY_FAILED Self signed certificate in flutter

I am making an https post Request from my flutter app. as there I am using a self signed SSL certificate in server so when I hit the API I am receiving status code as 405, that I am not able to connect, If I used HTTP package, I am getting bellow…
mark
  • 1,045
  • 2
  • 13
  • 23
8
votes
3 answers

flutter how to upload file with content type in dio

hello i try to upload image with dio package but i have to set contentType for image but i can not set it and get this error when set MediaType ====> The method 'MediaType' isn't defined for the type 'AnalyzeData'. this is mycode Dio dio = new…
mohammad shabani
  • 359
  • 1
  • 8
  • 15
7
votes
2 answers

optionsViewBuilder is not called in Autocomplete after fetching results from server

I'm trying to make an auto suggest input which fetches the results from a backend API. Here is my code: import 'dart:async'; import 'package:flutter/material.dart'; import 'package:hello_world/api.dart'; import…
Alireza Beitari
  • 436
  • 4
  • 15
7
votes
3 answers

How do calling API in flutter using Dio?

I need to parse JSON to object and use it in my app but I need to do this using dio library, but I'm new to it, can anybody help me how to use it to parse a JSON into an object, also my request need a token with it, my object will lock like this…
Qasem M. Zreaq
  • 139
  • 1
  • 1
  • 10
7
votes
1 answer

How to adjust download buffer size on flutter http, dio or flutter_downloader?

I want to download a large file that is amount of about 300MB. It was a lot slower than I thought, and when I looked at the log, I saw that it was fetching bytes with a size of about 8KB. I haven't found a way to resize the download buffer even if…
rollrat
  • 151
  • 13
7
votes
3 answers

Flutter download file to phone download directory

I have searched for similar questions and answers to this question but haven't found any specific answer till now. I am trying to save downloaded files to my internal phone storage. Preferably the download folder... Am using d i o and path…
Mr P
  • 129
  • 1
  • 2
  • 10
7
votes
1 answer

Cookies for Session ID not being saved from Dio and CookieJar

I am trying to make a web-scraper API for a specific website, which has some resources locked behind a login, and the login gives a session ID in the Cookies. When I tried POSTing my login, the session ID wasn't saved to CookieJar. Code: var dio =…
6
votes
0 answers

Flutter web - dio changes post requests into options requests

I'm using package:dio in a Flutter web application. Whenever I send a POST request, however, it gets changed into an OPTIONS request. The function that makes the API request looks like this: Future login(LoginRequest request) async { …
cameron1024
  • 9,083
  • 2
  • 16
  • 36
6
votes
1 answer

Why does flutter dio interceptor not invoking the method?

I am working on a flutter application which uses JWT to access backend endpoints. When the access token expires, I added an interceptor to refresh the token based on the solutions provided here: Using Interceptor in Dio for Flutter to Refresh…
Maverick
  • 2,738
  • 24
  • 91
  • 157
6
votes
3 answers

DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of 'FormData'

I'm new in Flutter. When i try to upload data to the server i faced some problems like: 1.NoSuchMethodError: The getter 'friendsList' was called on null 2.DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of…
6
votes
3 answers

How to setup a base URL and where do I declare it in flutter dio for api calls?

like how to fix boilerplate code in separate file and use it in ui pages. I Need to declare this uri variable in separate file and access across over all pages: static var uri = "https://xxx/xxx/web_api/public"; static BaseOptions options =…
Sanjeevi Raj
  • 81
  • 1
  • 3
  • 6
6
votes
1 answer

Is there an INTERNET permission in iOS?

i have a weird problem with dio package for flutter on iOS device. i wrote an app which sends a GET request to a url. everything works perfectly on Android but looks like the request doesn't go thru on iOS. nothing happens no error nothing at all. i…
Sepehr Azizi
  • 117
  • 1
  • 1
  • 8
1
2
3
44 45