You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a large app using built_value and I'm migrating it to using freezed and json_serializable. The app has data models that are shared between the client and server. When they are serialized to/from Firestore the DateTime objects are converted to Timestamps. With built_value I have two sets of serializers, one results in pure Dart DateTime objects and the other (firestoreSerializers) handles the pesky Timestamps, as these are passed to and from the json methods I have the flexibility to use the necessary serializers based on the context:
// Current solution of passing serializers (not using json_serializable)FooBar.fromJsonMap(
Serializers serializers, Map<String, dynamic> data) =>
serializers.deserializeWith(ChatMessage.serializer, data)!;
Map<String, dynamic> toJsonMap(Serializers serializers) =>Map.of(serializers.serialize(this, //....
Is there a Json Serializable recommended way to give me the flexibility to share the same data models but handle the serialization & deserialization of DateTime's differently according to context requirements? There are situations where both the client and server need to serialize & deserialize objects to/from firestore as well as none-Firestore contexts (sending/receiving the objects with cloud-endpoint, caching etc).
Thanks
The text was updated successfully, but these errors were encountered:
Hi, I have a large app using
built_value
and I'm migrating it to usingfreezed
andjson_serializable
. The app has data models that are shared between the client and server. When they are serialized to/from Firestore the DateTime objects are converted to Timestamps. With built_value I have two sets of serializers, one results in pure Dart DateTime objects and the other (firestoreSerializers
) handles the pesky Timestamps, as these are passed to and from the json methods I have the flexibility to use the necessary serializers based on the context:Is there a Json Serializable recommended way to give me the flexibility to share the same data models but handle the serialization & deserialization of DateTime's differently according to context requirements? There are situations where both the client and server need to serialize & deserialize objects to/from firestore as well as none-Firestore contexts (sending/receiving the objects with cloud-endpoint, caching etc).
Thanks
The text was updated successfully, but these errors were encountered: