knoxpo / dart_algolia

[Unofficial] Algolia is a pure dart SDK, wrapped around Algolia REST API for easy implementation for your Flutter or Dart projects.
Other
117 stars 112 forks source link

`Timestamp` objects get transformed into `Map<String, dynamic>` #84

Open aabounegm opened 2 years ago

aabounegm commented 2 years ago

Is your feature request related to a problem? Please describe. When using the official cloud_firestore SDK, any timestamps in the Firestore document get automatically converted to Timestamp objects. However, when using Algolia, they instead become a map that looks like {_seconds: 1643874320, _nanoseconds: 615000000} of type Map<String, dynamic>. This becomes especially inconvenient when using Firestore queries next to Algolia's, since two separate deserialization functions will have to be used.

Describe the solution you'd like I would like for the Algolia SDK to leave the original Firestore Timestamp objects intact for better compatibility with the official Firestore SDK.

Describe alternatives you've considered I considered writing separate factory constructors for .fromFirestore and .fromAlgolia, but it becomes inconvenient very quickly, especially that I want to migrate to automatically generated serialization functions using json_serializable.