@@ -22,7 +22,6 @@ import 'package:dogs_core/dogs_validation.dart';
2222import 'models.dart' ;
2323
2424class ConvertableA {
25-
2625 int a;
2726 int b;
2827
@@ -31,38 +30,35 @@ class ConvertableA {
3130 @override
3231 bool operator == (Object other) =>
3332 identical (this , other) ||
34- other is ConvertableA &&
35- runtimeType == other.runtimeType &&
36- a == other.a &&
37- b == other.b;
33+ other is ConvertableA && runtimeType == other.runtimeType && a == other.a && b == other.b;
3834
3935 @override
4036 int get hashCode => a.hashCode ^ b.hashCode;
4137}
4238
4339@linkSerializer
44- class ConvertableAConverter extends DogConverter <ConvertableA > with OperationMapMixin < ConvertableA > {
45-
40+ class ConvertableAConverter extends DogConverter <ConvertableA >
41+ with OperationMapMixin < ConvertableA > {
4642 @override
4743 Map <Type , OperationMode <ConvertableA > Function ()> get modes => {
48- NativeSerializerMode : () => NativeSerializerMode .create (
49- serializer: (value, engine) => [value.a, value.b],
50- deserializer: (value, engine) => ConvertableA (value[0 ], value[1 ]),
51- ),
52- };
44+ NativeSerializerMode : () => NativeSerializerMode .create (
45+ serializer: (value, engine) => [value.a, value.b],
46+ deserializer: (value, engine) => ConvertableA (value[0 ], value[1 ]),
47+ ),
48+ };
5349
54- ConvertableAConverter () : super (
55- struct: DogStructure <ConvertableA >.synthetic ("ConvertableA" )
56- );
50+ ConvertableAConverter () : super (struct: DogStructure <ConvertableA >.synthetic ("ConvertableA" ));
5751}
5852
5953@serializable
6054enum EnumA {
61- a,b,c,longNameValue;
55+ a,
56+ b,
57+ c,
58+ longNameValue;
6259}
6360
6461abstract class CustomBase {
65-
6662 // This should also be copied!
6763 @PropertyName ("_id" )
6864 final String id;
@@ -73,7 +69,6 @@ abstract class CustomBase {
7369}
7470
7571abstract class SecondLevelBase extends CustomBase {
76-
7772 @LengthRange (max: 100 )
7873 final String name;
7974
@@ -85,7 +80,6 @@ abstract class SecondLevelBase extends CustomBase {
8580
8681@serializable
8782class CustomBaseImpl extends SecondLevelBase with Dataclass <CustomBaseImpl > {
88-
8983 final String tag;
9084
9185 CustomBaseImpl ({
@@ -101,12 +95,10 @@ class CustomBaseImpl extends SecondLevelBase with Dataclass<CustomBaseImpl> {
10195 factory CustomBaseImpl .variant1 () {
10296 return CustomBaseImpl (id: "id1" , name: "Helga" , tag: "tag" );
10397 }
104-
10598}
10699
107100@serializable
108101class InitializersModel with Dataclass <InitializersModel > {
109-
110102 final String id;
111103
112104 InitializersModel (String ? id) : id = id ?? "default" ;
@@ -121,8 +113,7 @@ class InitializersModel with Dataclass<InitializersModel> {
121113}
122114
123115@serializable
124- class ConstructorBodyModel with Dataclass <ConstructorBodyModel >{
125-
116+ class ConstructorBodyModel with Dataclass <ConstructorBodyModel > {
126117 late String id;
127118 late String data;
128119
@@ -142,11 +133,10 @@ class ConstructorBodyModel with Dataclass<ConstructorBodyModel>{
142133
143134@serializable
144135class GetterModel with Dataclass <GetterModel > {
145-
146136 late String id;
147137 String ? _buffer;
148138
149- GetterModel (String ? id, String data) {
139+ GetterModel (String ? id, String data) {
150140 this .id = id ?? "default" ;
151141 _buffer = data;
152142 }
@@ -165,7 +155,6 @@ class GetterModel with Dataclass<GetterModel> {
165155
166156@serializable
167157class DefaultValueModel with Dataclass <DefaultValueModel > {
168-
169158 @DefaultValue ("default" )
170159 String a;
171160
@@ -190,13 +179,14 @@ class DefaultValueModel with Dataclass<DefaultValueModel> {
190179 }
191180
192181 static int bSupplier () => 420 ;
193- static ModelA cSupplier () => ModelA .variant0 ();
194182
183+ static ModelA cSupplier () => ModelA .variant0 ();
195184}
196185
197186@Serializable (serialName: "MyCustomSerialName" )
198187class CustomSerialName {
199188 String value;
189+
200190 CustomSerialName (this .value);
201191}
202192
@@ -263,7 +253,6 @@ enum EnumB {
263253 c;
264254}
265255
266-
267256@serializable
268257class CombinedEnumTestModel with Dataclass <CombinedEnumTestModel > {
269258 EnumA enumA;
@@ -283,11 +272,28 @@ class CombinedEnumTestModel with Dataclass<CombinedEnumTestModel> {
283272 }
284273}
285274
286- class CustomList <E > extends ListBase <E >{
275+ @serializable
276+ class CoerceTestModel with Dataclass <CoerceTestModel > {
277+ final int a;
278+ final double b;
279+
280+ CoerceTestModel (this .a, this .b);
287281
282+ static CoerceTestModel variant0 () {
283+ return CoerceTestModel (42 , 3 );
284+ }
285+
286+ static Map <String ,dynamic > variant0Input = {
287+ "a" : 42.2 ,
288+ "b" : 3
289+ };
290+ }
291+
292+ class CustomList <E > extends ListBase <E > {
288293 List <E > backing = [];
289294
290295 CustomList ();
296+
291297 CustomList .from (this .backing);
292298
293299 @override
@@ -311,6 +317,4 @@ class CustomList<E> extends ListBase<E>{
311317
312318@dogsLinked
313319final customListConverter = TreeBaseConverterFactory .createIterableFactory <CustomList >(
314- wrap: < T > (entries) => CustomList <T >.from (entries.toList ()),
315- unwrap: < T > (list) => list
316- );
320+ wrap: < T > (entries) => CustomList <T >.from (entries.toList ()), unwrap: < T > (list) => list);
0 commit comments