bool retryUntil(bool Function() predicate, {int maxAttempts = 10}) { for (int i = 0; i < maxAttempts; i++) { if (predicate()) return true; } return false; }