digest method

Future<Digest> digest(
  1. AssetId id

Returns a Digest representing a hash of the contents of id.

The digests should include the asset ID as well as the content of the file, as some build systems may rely on the digests for two files being different, even if their content is the same.

This should be treated as a transparent Digest and the implementation may differ based on the current build system being used.

Similar to readAsBytes, digest throws an exception if the asset can't be found or if it's an invalid input.


Future<Digest> digest(AssetId id) async {
  var digestSink = AccumulatorSink<Digest>();
    ..add(await readAsBytes(id))
  return digestSink.events.first;