toJson method

Map<String, Object> toJson()

This manifest as JSON.

Implementation

Map<String, Object> toJson() {
  var entries = _files.values
      .map((e) =>
          MapEntry(e.filePath, {'sha256': e.sha256Hex, 'length': e.length}))
      .toList();

  entries.sort((a, b) => a.key.compareTo(b.key));

  var filesMap = Map<String, Map<String, Object>>.fromEntries(entries);

  return {
    'release': '$release',
    'name': release.name,
    'version': '${release.version}',
    'platform': '${release.platform}',
    'date:': '${DateTime.now().toUtc()}',
    'files': filesMap,
  };
}