On this page
stat method
Future<FileStat> stat(Asynchronously calls the operating system's stat() function on path
. Returns a Future which completes with a FileStat object containing the data returned by stat(). If the call fails, completes the future with a FileStat object with .type set to FileSystemEntityType.NOT_FOUND and the other fields invalid.
Source
static Future<FileStat> stat(String path) {
// Trailing path is not supported on Windows.
if (Platform.isWindows) {
path = FileSystemEntity._trimTrailingPathSeparators(path);
}
return _IOService._dispatch(_FILE_STAT, [path]).then((response) {
if (_isErrorResponse(response)) {
return FileStat._notFound;
}
// Unwrap the real list from the "I'm not an error" wrapper.
List data = response[1];
return new FileStat._internal(
new DateTime.fromMillisecondsSinceEpoch(data[_CHANGED_TIME]),
new DateTime.fromMillisecondsSinceEpoch(data[_MODIFIED_TIME]),
new DateTime.fromMillisecondsSinceEpoch(data[_ACCESSED_TIME]),
FileSystemEntityType._lookup(data[_TYPE]),
data[_MODE],
data[_SIZE]);
});
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-io/FileStat/stat.html