waitForState<T> method

Future<void> waitForState<T>(
  1. String key,
  2. T expectedValue, {
  3. Duration timeout = const Duration(seconds: 5),
})

Wait for state to have a specific value

Implementation

Future<void> waitForState<T>(
  String key,
  T expectedValue, {
  Duration timeout = const Duration(seconds: 5),
}) async {
  await waitFor(() => getState<T>(key) == expectedValue, timeout: timeout);
}