Dynamically create a text file for download using Dart
This question has already been asked and answered for JS. Very similar solutions to those in that thread apply to Dart with very little modification. For example we could create an anchor element with a custom data URI and either present it to the user or call its click
method:
String encodedFileContents = Uri.encodeComponent("Hello World!");new AnchorElement(href: "data:text/plain;charset=utf-8,$encodedFileContents") ..setAttribute("download", "file.txt") ..click();
See DartPad example that allows the user to edit a table element's cells and then download the cell contents as a csv file.