Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In pumpAndSettle() in Flutter, how can I specify timeout without also passing in EnginePhase?

The pumpAndSettle() documentation says that I can pass in a timeout. I do this via:

await tester.pumpAndSettle(Duration(minutes: 11), 
  EnginePhase.sendSemanticsUpdate, 
  Duration(minutes: 12),
);

How do I pass in a timeout without having to also specify the EnginePhase? I just want to use the default EnginePhase.

I tried:

await tester.pumpAndSettle(Duration(minutes: 11), 
  Duration(minutes: 12),
);


await tester.pumpAndSettle([Duration(minutes: 11), 
  Duration(minutes: 12),
]);


await tester.pumpAndSettle(duration: Duration(minutes: 11), 
  timeout: Duration(minutes: 12),
);

await tester.pumpAndSettle(Duration(minutes: 11), 
  timeout: Duration(minutes: 12),
);

What is the name of this syntax, where you have an optional List of inputs in a function? I tried to look it up in Dart syntax but wasn't sure what it was called.

like image 925
Mary Avatar asked Nov 15 '25 22:11

Mary


1 Answers

You can't. pumpAndSettle uses optional positional arguments, so you can't specify later arguments without also providing earlier arguments.

like image 71
jamesdlin Avatar answered Nov 18 '25 20:11

jamesdlin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!