activate method

bool activate(
  1. String id
)

Move an existing surface to the top without changing others' relative order.

No-op if id is missing or already top. Resets pending on the previous top.

Implementation

bool activate(String id) {
  final i = _indexOf(id);
  if (i < 0) return false;
  if (i == _stack.length - 1) return true;
  final prevTop = top;
  prevTop?.reset();
  final surface = _stack.removeAt(i);
  _stack.add(surface);
  _notifyStack();
  onPendingChanged?.call();
  return true;
}