Can I make a database query, with a condition that filters out any elements when a text field doesn't have length 2 or 3 characters?
There is no built-in condition for this.
The approach here would be to try to reduce the number of results with built-in conditions as much as possible, then use .where()
on the result list to filter the results. Wrap this in store.runInTransactionAsync
to run it on a worker isolate. Something like this:
List<User> filterByLength(Store store, String preFilter) {
var box = store.box<User>();
final query = box.query(...).build();
final results = query.find().where(...);
query.close();
return results;
}
final results =
await store.runInTransactionAsync(TxMode.read, filterByLength, preFilter);
https://docs.objectbox.io/getting-started#asynchronous-operations