Gets a validated digest from an array of bytes
Parameter bytes: the bytes to be converted into a digest
Returns a validated digest with a possible invalid digest error
A necessary factory constructor for creating a new Digest instance
from a map. Pass the map to the generated _$DigestFromJson() constructor.
The constructor is named after the source class, in this case, Digest.
toJson is the convention for a class to declare support for serialization
to JSON. The implementation simply calls the private, generated
helper method _$DigestToJson.