Skip to content

Cursor closed despite moveNext() returning true #1113

Open
@Erfa

Description

@Erfa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions