readFile static method
The same, given the file itself.
Implementation
static StoreShotsReport? readFile(File file) {
if (!file.existsSync()) return null;
try {
var json = jsonDecode(file.readAsStringSync());
if (json is! Map) return null;
if (json['version'] != storeShotsReportVersion) return null;
return StoreShotsReport(
sets: [
for (var entry in json['sets'] as List? ?? [])
if (entry is Map)
?StoreShotsSet.fromJson(entry.cast<String, Object?>()),
],
);
} on FormatException {
return null;
}
}