Client-side downloads can be performed with the following code:
void downloadFileToClient(String filename, String text){ AnchorElement tl = document.createElement('a'); tl..attributes['href'] = 'data:text/plain;charset=utf-8,' + Uri.encodeComponent(text) ..attributes['download'] = filename ..click(); }
It depends on the browser support for the download attribute on the anchor tags. Check the target platform for suitability.
The CanIUse site provides status for platforms and browser versions.
source share