Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import 'dart:io';
import 'dart:async';
Future createFile(String fileName, String text){
return new File(fileName).create()
.then((File file){
return 'the file has been created with "$text" as its content';
void main(){
final String text = "Dart is fun!";
createFile('test.txt', text)
.then((value) => print(value))
.catchError((e) => print(e.toString()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment