writeAsString method

  1. @override
Future writeAsString(
  1. AssetId id,
  2. String contents,
  3. {Encoding encoding = utf8}

Writes contents to a text file located at id with encoding.

Returns a Future that completes after writing the asset out.

  • Throws a PackageNotFoundException if id.package is not found.
  • Throws an InvalidOutputException if the output was not valid.


Future writeAsString(AssetId id, String contents,
    {Encoding encoding = utf8}) async {
  assets[id] = encoding.encode(contents);