ScenarioRunIndex.fromJson constructor

ScenarioRunIndex.fromJson(
  1. Map<String, Object?> json
)

Decodes an index.json.

Throws FormatException on a version this reader does not know, like ScenarioRunResult.fromJson and for the same reason.

Implementation

factory ScenarioRunIndex.fromJson(Map<String, Object?> json) {
  var version = _int(json['version'], 1);
  if (version > scenarioRunReportVersion) {
    throw FormatException(
      'This run index is version $version and this is a reader for '
      '$scenarioRunReportVersion. Upgrade the flutterware dependency of '
      'whatever reads it.',
    );
  }
  return ScenarioRunIndex(
    version: version,
    runs: _listOf(json['runs'], ScenarioRunIndexEntry.fromJson),
  );
}