String path
) 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
/**
* 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.
*/
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]);
});
}