Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save kasperpeulen/f06777c610605646c43e to your computer and use it in GitHub Desktop.

Select an option

Save kasperpeulen/f06777c610605646c43e to your computer and use it in GitHub Desktop.
Creating a file.
import 'dart:io';
import 'dart:async';
Future main() async {
// Get the system temp directory.
Directory systemTempDir = Directory.systemTemp;
// Creates dir/, dir/subdir/, and dir/subdir/file.txt in the system
// temp directory.
File file = await new File('${systemTempDir.path}/dir/subdir/file.txt')
.create(recursive: true);
print(await file.exists());
}
name: dart.io_File.create
description: |
Creating a file.
Use the File create() method to create a file. To create intermediate directories, set the recursive argument to true (default is false).
homepage: https://gist.github.com/kasperpeulen/f06777c610605646c43e
environment:
sdk: '>=1.11.0 <2.0.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment