waitCondition method Null safety

Future<void> waitCondition(
  1. bool condition(
    1. St
  2. {int? timeoutInSeconds}

Returns a future which will complete when the given condition is true. The condition can access the state. You may also provide a timeoutInSeconds, which by default is null (never times out).


Future<void> waitCondition(
  bool Function(St) condition, {
  int? timeoutInSeconds,
}) async {
  var conditionTester = StoreTester.simple(this);
  try {
    await conditionTester.waitCondition(
      (TestInfo<St>? info) => condition(info!.state),
      timeoutInSeconds: timeoutInSeconds,
  } finally {
    await conditionTester.cancel();