aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

Can aqueduct use json_serializable except extending from Serialize?

Open NazarKalytiuk opened this issue 4 years ago • 3 comments

https://pub.dev/packages/json_serializable

It's hard to write asMap and readFromMap all time, especially for big classes. Also looks like flutter and dart recommend this library https://dart.dev/guides/json

NazarKalytiuk avatar May 19 '20 00:05 NazarKalytiuk

Short answer is: No.

The long answer is: You should not need to implement Serializable that often as you would usually serialize and deserialize db models and they already implement it.

Another long answer is: No body is stopping you from using JsonSerializable, the only case you can not get around it is when you want to bind the body of a http request.

Reductions avatar May 19 '20 01:05 Reductions

The near future view considers being able to have AOT image of Aqueduct. This implies removing the dependency on dart:mirrors.

But json_serializable has this dependency, so I guess you could use it, but declared in dev_dependencies section.

dxps avatar Jun 02 '20 18:06 dxps

The problem is that json_serializable and Serialize can't play together. So if you have Flutter client app and Aqueduct server app, you have to manually serialize/deserialize models on the client app. Quite inconvenient.

agordeev avatar Jun 24 '20 12:06 agordeev