bool isWaitingFor(Object? flag, {Object? ref}) { Set? refs = _flags[flag]; if (ref == null) return refs != null && refs.isNotEmpty; else return refs != null && refs.contains(ref); }