Skip to content
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

Cursor closed despite moveNext() returning true #1113

Open
Erfa opened this issue Jun 15, 2024 · 1 comment
Open

Cursor closed despite moveNext() returning true #1113

Erfa opened this issue Jun 15, 2024 · 1 comment

Comments

@Erfa
Copy link

Erfa commented Jun 15, 2024

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?

@alextekartik
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants