Future<T> waitUntil<T>(bool Function(T) predicate) async => (await waitUntilUnsafe(T, (it) => predicate(it as T))) as T;