-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query dont check if String Text OR Text OR Text is exist one of them in List[i] #1
Comments
After you have the parsed main() {
final list = <String>['a', 'text3'];
final query = parseQuery('text OR text2 OR text3');
final matches = _evalQuery(query, list);
print('matched: $matches');
}
bool _evalQuery(Query query, List<String> list) {
if (query is OrQuery) {
return query.children.any((q) => _evalQuery(q, list));
} else if (query is TextQuery) {
return list.contains(query.text);
} else {
throw Exception('Unknown query type: $query');
}
} Does this help? |
it works but didn't solve what I need, the point is if Text3 exists, print the Text3 from the list, your solution is to print true if exist |
You could return a composite object that has the boolean flag and the extracted value. It makes it a bit more complex though, but the base principle remains the same. |
why don't you make full documentation for the library, your example is not totally clear for the use and also it's not really clear how to use it with lists unfortunately |
Yeah, it is lacking documentation, but I always welcome PRs :) |
that's gonna be great @isoos if did that, just last one thing I may need you give hand with , I have list of Documents comes from Firestore and saved in List I have 2 lists i've tried many times but didn't work for me with the library |
how to check if String Text OR Text OR Text is exist one of them in List[i]
The text was updated successfully, but these errors were encountered: