Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
Created August 4, 2015 02:07
Show Gist options
  • Select an option

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

Select an option

Save kasperpeulen/bf54439b64b66f855a46 to your computer and use it in GitHub Desktop.
Finding the type of a filesystem object
import 'dart:io';
import 'dart:async';
Future main() async {
// List the contents of the system temp directory.
await for(FileSystemEntity entity in Directory.systemTemp.list()) {
FileSystemEntityType type = await FileSystemEntity.type(entity.path);
// Get the type of the FileSystemEntity
print('$type: ${entity.path}');
}
}
name: dart.io_FileSystemEntity.type
description: |
Finding the type of a filesystem object
Use the FileSystemEntity.type() method to get the type of a file system object. This method is inherited by File, Directory, and Link.
homepage: https://gist.github.com/kasperpeulen/bf54439b64b66f855a46
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