moveTo method
Moves the tab at index into destination, reporting how it travelled.
DVWindowHandover.sameEngine means the tab arrived whole: its element is reparented into the receiving workspace, so the text someone was half way through typing, the position they had scrolled to, the controllers and the requests still in flight are the same objects afterwards. That is the difference between a re-dock and a tab that looks right and is empty.
DVWindowHandover.shared means it did not: destination already had a
tab on that route and focused it, so this tab was closed and nothing but
the shared store crossed. Null means index named no tab.
Both workspaces must be on screen. That is not a restriction so much as
what "the same engine" means here: DVWindowHost renders every window as
a View in one ViewCollection, so two windows share a build owner and
an element can move between them -- and a workspace that is not mounted
has no element tree to move into. moveDestinations lists the ones that
qualify.
Implementation
Future<DVWindowHandover?> moveTo(
DVTabWorkspaceController destination,
int index,
) async {
final _DVTabEntry? entry =
_removeEntryAt(index, reason: DVTabExit.adopted);
if (entry == null) return null;
// The receiver takes it before anything is awaited. Both notifications
// then land in the same frame, which is the entire mechanism: an await in
// between would put the departure in one frame and the arrival in the
// next, the element would be unmounted in the gap, and the handover would
// quietly become a rebuild that still looks correct on screen.
final bool taken = destination._adopt(entry);
await _closeIfEmptied();
return taken ? DVWindowHandover.sameEngine : DVWindowHandover.shared;
}