readAsString method
Returns a Future that completes with the contents of a text asset.
When decoding as text uses encoding
, or utf8 is not specified.
- Throws a
PackageNotFoundException
ifid.package
is not found. - Throws a
AssetNotFoundException
ifid.path
is not found. - Throws an
InvalidInputException
ifid
is an invalid input.
Implementation
@override
Future<String> readAsString(AssetId id, {Encoding encoding = utf8}) async {
if (_assetGraph.get(id)?.isDeleted ?? true) {
throw AssetNotFoundException(id);
}
return _delegate.readAsString(id, encoding: encoding);
}