writeAsString method
Writes contents
to a text file located at id
with encoding
.
Returns a Future that completes after writing the asset out.
- Throws a
PackageNotFoundException
ifid.package
is not found. - Throws an
InvalidOutputException
if the output was not valid.
Implementation
@override
Future writeAsString(AssetId id, String contents,
{Encoding encoding = utf8}) async {
var file = _fileFor(id, packageGraph);
await _descriptorPool.withResource(() async {
await file.create(recursive: true);
await file.writeAsString(contents, encoding: encoding);
});
}