Questions tagged [dart-io]

dart:io allows you to work with files, directories, sockets, processes, HTTP servers and clients, and more

dart:io library is used for Dart server applications, which run on a stand-alone Dart VM from the command line. This library does not work in browser based applications.

This library allows you to work with files, directories, sockets, processes, HTTP servers and clients, and more.

191 questions
0
votes
0 answers

failing to get response from http.post [http: 499]

I want to build a payment page with the use of a payment page provider. I therefore created a class which builds with a futureBuilder the needed Widgets. From an API I want to receive an URL which I want to embed with an iFrame. However, the future…
Yves Boutellier
  • 1,286
  • 9
  • 19
0
votes
1 answer

Uploading pdf generated in flutter web to S3

I am using the pdf 3.6.0 library from pub.dev to generate a pdf in flutter web. When I save the document using doc.save(), I get a Future. I want to upload this file to S3 For android/ios, I first save the Uint8List as a file in a temp…
RIP71DE
  • 51
  • 3
0
votes
1 answer

Flutter dart:io problem with reading and writing file

I'm trying to read data from TXT file but somthing goes wrong. There is a code import 'dart:async' import 'dart:io'; void main(){ File('file.txt').readAsString().then((String contents){ print(contents); }); } This is code From official…
GDTyka
  • 472
  • 3
  • 16
0
votes
1 answer

How to read txt file as Stream in Flutter

i have school project,we are currently doing voice controlled kiosk and the navigation through app will be with voice commands,im doing the application part but im having hard times with integrating with ml team,so the thing is they take the voice…
0
votes
1 answer

Dart Image to File in local storage

I'm using the Image class from the package image. I have to download a image from internet and save it in my local storage. Then modify this image and save the changes. I have done the first 2 steps, but when i'm saving the file, this is corrupted…
Jorge Luis
  • 902
  • 12
  • 25
0
votes
0 answers

WebSocket connection from Dart/Flutter to Google Cloud Run fails

did anyone use WebSocket connections between a Flutter/Dart client and a server running on Google Cloud Run successfully? Exactly this combination fails for me. The client works with the same server on localhost. Another client works with the same…
0
votes
1 answer

Dart Reading Bytes from File and Converting to Double

In Dart/Flutter, I'm trying to read bytes from a data file (2 bytes per value; on a mobile device) and convert to a double. I have the below code: fileToData(File filename) { var bytes = filename.readAsBytesSync(); return…
maxwell79
  • 123
  • 1
  • 6
0
votes
2 answers

Flutter Web: Converting dart:io File to dart:html File

Is there a way to convert dart:io File object to dart:html File? I tried html.File file = dartFile as html.File and it isn't working
Henzelix
  • 65
  • 1
  • 10
0
votes
1 answer

How to take stdin input and break in whitespace in dart?

I want to take 5 inputs like 1 2 3 4 5 using a for loop that runs 5 times. stdin.readLineSync() takes the whitespace as an input and continues until I press ENTER but I want it to separate by whitespace like scanf in C. How can I do that ?
Kedar Karki
  • 429
  • 4
  • 13
0
votes
1 answer

Map json from server answer in flutter app

I have a webserver, that always returns a String in this json format: {"status":100,"content":[{"version":"2.2.2"}]} I want my flutter app to map this json to a Map` everytime on appstart to check if a new version is available. To…
Salatgurke
  • 1,554
  • 1
  • 13
  • 35
0
votes
1 answer

How to set limit for max connection for single client in Dart http_server?

I have created a simple flutter app to serve my phone directory (Index of /) to share my files with the PC. (I used IDM (Internet Download Manager) to download file) it works fine on small files, but the app got closed automatically when I am…
SKJ
  • 237
  • 2
  • 11
0
votes
0 answers

Flutter create folder after installing

I'm trying to create folder after installing app. for example like this question Create Folder When Installing Application i follow two solution https://stackoverflow.com/a/54848857 https://stackoverflow.com/a/55349516 I'm trying to download Image…
Arteesy
  • 71
  • 2
  • 10
0
votes
0 answers

Dart http: Failed to parse header value (www-authenticate)

Dart fails to parse the www-authenticate response header. For example: The result of curl -i -X POST https://api.thetvdb.com/login is: HTTP/2 401 date: Mon, 29 Jul 2019 09:15:50 GMT content-type: application/json; charset=utf-8 content-length:…
Itay Karo
  • 17,924
  • 4
  • 40
  • 58
0
votes
1 answer

Directory comparison not working in Dart?

Why directory comparison does not work the expected way in Dart? import 'dart:io'; void main() { Directory d = Directory('/kek'); Directory e = Directory('/kek'); print(d==e); // false print(d.hashCode); // 123456 print(e.hashCode); //…
aleskva
  • 1,644
  • 2
  • 21
  • 40
0
votes
1 answer

How to open file for writing?

I'm trying to open and write to a file using Dart's IO library. I have this code: File file = File("text.txt"); RandomAccessFile raf = file.openSync(); raf.writeStringSync("A string!"); Now when doing this I get the following error in the console:…
Matija
  • 2,610
  • 1
  • 18
  • 18