Fix EXIF error when converting from JSON

This commit is contained in:
Ming Ming 2021-04-15 06:55:47 +08:00
parent 400abd33e4
commit 12421aa1d8
2 changed files with 17 additions and 8 deletions

View file

@ -106,12 +106,21 @@ class Album {
File albumFile, File albumFile,
}) { }) {
// there's only one version right now // there's only one version right now
return Album( if (version < 2) {
lastUpdated: lastUpdated, return Album(
name: name, lastUpdated: lastUpdated,
items: items, name: name,
albumFile: albumFile, items: [],
); albumFile: albumFile,
);
} else {
return Album(
lastUpdated: lastUpdated,
name: name,
items: items,
albumFile: albumFile,
);
}
} }
factory Album.fromJson(Map<String, dynamic> json) { factory Album.fromJson(Map<String, dynamic> json) {
@ -191,7 +200,7 @@ class Album {
final File albumFile; final File albumFile;
/// versioning of this class, use to upgrade old persisted album /// versioning of this class, use to upgrade old persisted album
static const version = 1; static const version = 2;
} }
class AlbumRepo { class AlbumRepo {

View file

@ -44,7 +44,7 @@ class Exif {
if (e is Map) { if (e is Map) {
return Rational.fromJson(e.cast<String, dynamic>()); return Rational.fromJson(e.cast<String, dynamic>());
} else { } else {
return value; return e;
} }
}).toList(); }).toList();
} else { } else {