processLifecycleEvents method

void processLifecycleEvents()
inherited

Implementation

void processLifecycleEvents() {
  assert(_blocked.isEmpty);
  var repeatLoop = true;
  while (repeatLoop) {
    repeatLoop = false;
    for (final event in _queue) {
      final child = event.child!;
      final parent = event.parent!;
      if (_blocked.contains(identityHashCode(child)) ||
          _blocked.contains(identityHashCode(parent))) {
        continue;
      }
      var status = LifecycleEventStatus.done;
      switch (event.kind) {
        case _LifecycleEventKind.add:
          status = child.handleLifecycleEventAdd(parent);
          break;
        case _LifecycleEventKind.remove:
          status = child.handleLifecycleEventRemove(parent);
          break;
        case _LifecycleEventKind.move:
          status = child.handleLifecycleEventMove(parent);
          break;
        case _LifecycleEventKind.unknown:
          break;
      }
      switch (status) {
        case LifecycleEventStatus.done:
          _queue.removeCurrent();
          repeatLoop = true;
          break;
        case LifecycleEventStatus.block:
          _blocked.add(identityHashCode(child));
          _blocked.add(identityHashCode(parent));
          break;
        default:
          break;
      }
    }
    _blocked.clear();
  }
}