objectboxflutter-objectbox

How to change query condition (not parameter)?


I want to reuse queries, and I know it is possible to change parameter, but how does one change the condition? And do we have to always call query.close()?


Solution

  • For a built query only the parameter values can be changed. To get different conditions (== new query) a new query needs to be built.

    And yes, calling query.close() is recommended to immediately free used resources. However, it's fine to keep a query around if your code will use it again.

    https://docs.objectbox.io/queries#reusing-queries-and-parameters