I’m new to flutter and Isar. I have the following class
@collection
class RootWord {
Id id = Isar.autoIncrement;
@Index()
late int subCategoryId;
late String name;
late List<Word> wordList;
late bool hide;
}
I have a collection of RootWords and I’m trying to find all the RootWords that contain a certain Word in RootWord.wordList. I’m not familiar with quering lists in Isar so obviously my code is all wrong.
List<RootWord> findRootWords({required Isar isar, required String str) {
return isar.rootWords.filter().wordListElement((q) => q.engWordContains(str, caseSensitive: false));
}
Thank you for helping me
2
Answers
This works for me.
I also recently started learning Isar. To begin with, make the Word class a separate collection, and then add IsarLink to the RootWord as in the documentation. After that you will be able to make queries