readAsString method

  1. @override
Future<String> readAsString(
  1. AssetId id,
  2. {Encoding encoding = utf8}

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 if id.package is not found.
  • Throws a AssetNotFoundException if id.path is not found.
  • Throws an InvalidInputException if id is an invalid input.


Future<String> readAsString(AssetId id, {Encoding encoding = utf8}) =>
    _resolve(id)?.readAsString(encoding: encoding) ??
    (throw AssetNotFoundException(id));