After version 1.0.0 of algolia_helper_flutter, I noticed that the hit data includes '_highlightResult', which does not match the user's model data. This results in a TypeError.
Stream<_HitsPage> get _searchPage =>
hitsSearcher.responses.map(_HitsPage.fromResponse);
....
class _HitsPage {
const _HitsPage(this.items, this.pageKey, this.nbPages, this.nextPageKey);
final List<ItemData> items;
final int pageKey;
final int? nextPageKey;
final int nbPages;
factory _HitsPage.fromResponse(SearchResponse response) {
logger.info('>>>> data hits:${response.hits} / nbPages:${response.nbPages}');
// TypeError : null: type 'Null' is not a subtype of type 'String'
final List<ItemData> items = response.hits.map(ItemData.fromJson).toList();
logger.info('>>>> items hits:${items.length}');
final bool isLastPage = response.page >= response.nbPages;
final int? nextPageKey = isLastPage ? null : response.page + 1;
return _HitsPage(items, response.page, response.nbPages, nextPageKey);
}
}
Hit data
INFO: >>>> data hits:[Hit{ json:
{objectID: sw7YaNb0YKwmvxJKdKxw,
_highlightResult: {name: {value: Rolex stock 22, matchLevel: none, matchedWords: []},
mainCategory: {value: StockOffer, matchLevel: none, matchedWords: []}},
............. published: true, createdAt: 2023-12-11T23:45:31.509, updatedAt: 2024-04-25 22:26:44.829}}]
ℹ️ INFO: >>>Has Error:TypeError: null: type 'Null' is not a subtype of type 'String'
I found the root cause of the issue. It was not related to '_highlightResult' but rather a problem with the data itself. Now that it's been resolved, I will close this.
After version 1.0.0 of algolia_helper_flutter, I noticed that the hit data includes '_highlightResult', which does not match the user's model data. This results in a TypeError.
Hit data