I've seen this for a long time and it seems strange. I have something simple like this:
final isOpen = await cursor.moveNext();
if (isOpen) {
final row = cursor.current;
// Do something with row
}
I often see that accessing the current row fails with StateError: Cursor is closed, cannot get current row. Seems to happen more often if I have a query in a parent page that exists while I navigate into a child page in Flutter.
How is this possible? Isn't the entire point of the return value from moveNext() to say that it's safe to access current?
Indeed that should not happen. Hard to say without seeing more code as I cannot manage to reproduce. Do you have a way to reproduce in a simple example?
I've seen this for a long time and it seems strange. I have something simple like this:
I often see that accessing the current row fails with
StateError: Cursor is closed, cannot get current row
. Seems to happen more often if I have a query in a parent page that exists while I navigate into a child page in Flutter.How is this possible? Isn't the entire point of the return value from
moveNext()
to say that it's safe to accesscurrent
?