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

View file

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