readText method
Implementation
@override
Future<String> readText(EaglePath path) async {
try {
final candidate = _lexical(path);
final type = await FileSystemEntity.type(candidate, followLinks: false);
if (type == FileSystemEntityType.notFound) {
throw EagleSourceException('File does not exist: $path');
}
final resolved = await _resolvedContained(candidate, type);
if (await FileSystemEntity.type(resolved) != FileSystemEntityType.file) {
throw EagleSourceException('Path is not a file: $path');
}
return File(resolved).readAsString();
} on EagleSourceException {
rethrow;
} catch (error) {
throw EagleSourceException('Text file cannot be read.', cause: error);
}
}