dragGeneration property

int get dragGeneration

Monotonically increasing identity for drag sessions.

Starts at 0 and increments by exactly one each time startDrag INSTALLS a session, before that call's session-start notification. Never decreases and never repeats, so it answers "is this still the drag that was in flight when I scheduled this?", which isDragging and draggedKey cannot: the same node dragged twice is indistinguishable through them.

Deferred work captures the value and re-reads it later; a mismatch means the callback has been outlived by its session. That single compare covers a replacement session (startDrag cancels a live one first, so a listener sees isDragging go false then true inside one call), a start that BAILS after that cancel (which notifies false with no matching true, and consumes no generation), and callbacks arriving after a later session has both begun and ended.

Not incremented by endDrag, cancelDrag or dispose: it identifies the session, not its transitions.

Implementation

int get dragGeneration => _dragGeneration;