debugIsVisible method Null safety

bool debugIsVisible(
  1. OverlayEntry entry

(DEBUG ONLY) Check whether a given entry is visible (i.e., not behind an opaque entry).

This is an O(N) algorithm, and should not be necessary except for debug asserts. To avoid people depending on it, this function is implemented only in debug mode, and always returns false in release mode.


bool debugIsVisible(OverlayEntry entry) {
  bool result = false;
  assert(() {
    for (int i = _entries.length - 1; i > 0; i -= 1) {
      final OverlayEntry candidate = _entries[i];
      if (candidate == entry) {
        result = true;
      if (candidate.opaque)
    return true;
  return result;