mirror of https://github.com/AMT-Cheif/drift.git
Fix not null when using JsonTypeConverter (#1820)
* Fix not null when using JsonTypeConverter * Run dart format on writer Co-authored-by: Alexander Wilde <alexander.wilde87@gmail.com> Co-authored-by: Simon Binder <oss@simonbinder.eu>
This commit is contained in:
parent
d23028a5bb
commit
5bf9b2a3aa
|
@ -144,8 +144,10 @@ class DataClassWriter {
|
||||||
if (typeConverter != null && typeConverter.alsoAppliesToJsonConversion) {
|
if (typeConverter != null && typeConverter.alsoAppliesToJsonConversion) {
|
||||||
final type = column.innerColumnType(scope.generationOptions);
|
final type = column.innerColumnType(scope.generationOptions);
|
||||||
final fromConverter = "serializer.fromJson<$type>(json['$jsonKey'])";
|
final fromConverter = "serializer.fromJson<$type>(json['$jsonKey'])";
|
||||||
|
final notNull =
|
||||||
|
!column.nullable && scope.generationOptions.nnbd ? '!' : '';
|
||||||
deserialized =
|
deserialized =
|
||||||
'${typeConverter.tableAndField}.fromJson($fromConverter)';
|
'${typeConverter.tableAndField}.fromJson($fromConverter)$notNull';
|
||||||
} else {
|
} else {
|
||||||
final type = column.dartTypeCode(scope.generationOptions);
|
final type = column.dartTypeCode(scope.generationOptions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue