'Flutter Integration Test: How to wait until element is disappear with specific time out

I am writing a Flutter Integration Test and I'm looking for a code which that allows the automated test to run and proceed after the Login (check step below) finishes automatically. .....

here are the step involves

  1. Enter username and password
  2. hit login button
  3. then the loading modal will show up for 2 mins // at this step I need to find some code to make sure that the modal is disappeared so that it can proceed to the next step.

It's just like Wait Until Element Does Not Contain in Selenium

here is my code

  await tester.pumpAndSettle();
  await Future.delayed(const Duration(seconds: 4));
  await tester.pumpAndSettle();
  
  var textBoxForPhone = find.byKey(const Key('txtbPhone'));
  var textBoxForPass = find.byKey(const Key('txtbPass'));
  var btnLogin = find.byKey(const Key('btnLogin'));

  var syncMasterModal = find.byKey(const Key('syncMasterModal'));

// Input Username
  await tester.enterText(textBoxForPhone, '9108717875');
// Input Password
  await tester.enterText(textBoxForPass, '12345');
  await tester.testTextInput.receiveAction(TextInputAction.done);
  await tester.pumpAndSettle();
// Tap Login button
  await tester.tap(btnLogin);

//After tapping the login button the loading modal will appear and it takes about 2 minutes to finish this process
// So it is at this step where I need the code to detect whether the loading modal is disappear 
  

So could you guys help point me in the right direction?

PS. This is my first time here and English is not my first language so, I'm sorry if my text here is a bit confusing.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source