Merge branch 'master' into develop

This commit is contained in:
Simon Binder 2019-06-27 10:01:05 +02:00
commit 6d54a21091
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
3 changed files with 12 additions and 1 deletions

View File

@ -86,7 +86,11 @@ class _DefaultValueSerializer extends ValueSerializer {
@override
T fromJson<T>(json) {
if (T == DateTime) {
return DateTime.fromMillisecondsSinceEpoch(json as int) as T;
if (json == null) {
return null;
} else {
return DateTime.fromMillisecondsSinceEpoch(json as int) as T;
}
}
return json as T;

View File

@ -54,6 +54,12 @@ class CustomSerializer extends ValueSerializer {
}
void main() {
test('default serializer', () {
final serializer = const ValueSerializer.defaults();
expect(serializer.toJson<DateTime>(null), null);
expect(serializer.fromJson<DateTime>(null), null);
});
group('serialization', () {
test('with defaults', () {
expect(someTodoEntry.toJson(), equals(regularSerialized));

View File

@ -19,6 +19,7 @@ void main() {
expect(() async {
await db.transaction((t) {
t.select(db.users).watch();
return Future.value(null); // analysis warning in travis otherwise
});
}, throwsStateError);