aqueduct
aqueduct copied to clipboard
Can aqueduct use json_serializable except extending from Serialize?
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
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.
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.
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.