Pregunta

I want to make an entirely client-side text editor. Unfortunately, dart:io doesn't work client-side. I want to save text the user has typed to a file on the his machine. He can have full control of where it saves or whatever hoops I have to jump through for it to be considered safe. Is it possible to write a file to his machine?

¿Fue útil?

Solución

See this equivalent answer for JavaScript:

Write local file with jQuery or Javascript

The web platform is specifically designed to prevent sites from writing arbitrary data to client machines.

This is to protect your machine.

One way that I have seen this worked around is to use something like dropbox or google drive api, so that your app "edits" a file on dropbox or gdrive, which is then synced onto your local disk by the dropbox or gdrive client. Eg: SourceKit


Otros consejos

You can use HTML5 and LocalStorage. It's a persistent storage, but can only be accessed by the browser.

If you want the user to be able to open the file outside the browser, just make the "save" button a download action.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top