WaitUntilTypeExistsStep function
StepDefinitionGeneric<World>
WaitUntilTypeExistsStep()
Waits until a widget type is present or absent.
Examples:
Then I wait until the element of type "ProgressIndicator" is absent
And I wait until the button of type the "MaterialButton" is present
Implementation
StepDefinitionGeneric WaitUntilTypeExistsStep() {
return then2<String, Existence, FlutterWorld>(
'I wait until the (?:button|element|label|icon|field|text|widget) of type {string} is {existence}',
(ofType, existence, context) async {
await FlutterDriverUtils.waitUntil(
context.world.driver,
() {
return existence == Existence.absent
? FlutterDriverUtils.isAbsent(
context.world.driver,
find.byType(ofType),
)
: FlutterDriverUtils.isPresent(
context.world.driver,
find.byType(ofType),
);
},
);
},
);
}