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

`AlgoliaIndexReference.facetQuery` should accept facets without `objectID` #88

Closed Chralu closed 2 years ago

Chralu commented 2 years ago

Flutter version: 2.10.3 (stable)

Describe the bug When querying a simple string facet, library throws a "type 'Null' is not a subtype of type 'String'" error.

To Reproduce Steps to reproduce the behavior:

  1. In Algolia settings, setup a facet on a string property
  2. In your Flutter code, run a query like :
final algolia = Algolia.init(
      applicationId: <my_application_id>,
      apiKey: <my_api_key>,
);

await algolia
        ?.index(<my_index>)
        .facetQuery(<my_simple_facet_name>);

It will throw an error when converting Algolia response to AlgoliaFacetValueSnapshot.

Expected behavior AlgoliaFacetValueSnapshot.objectID should accept null value.

nhathiwala commented 2 years ago

This has been fix in 1.0.5