Skip to content

Instantly share code, notes, and snippets.

@Boehrsi
Last active March 5, 2023 05:57
Show Gist options
  • Save Boehrsi/93c26371431367a639476a3a860ead60 to your computer and use it in GitHub Desktop.
Save Boehrsi/93c26371431367a639476a3a860ead60 to your computer and use it in GitHub Desktop.
During development I encountered https://github.com/flutter/flutter/issues/41029 and didn't liked the solution with hardcoded waiting times. I'm now waiting for the first frame to be rastered successfully and ignoring errors in the meantime. This works well for my tests and avoids hardcoded timings, which often fail (e.g. on a different machine).
Future<FlutterDriver> setupAndGetDriver() async {
FlutterDriver driver = await FlutterDriver.connect();
var connected = false;
while (!connected) {
try {
await driver.waitUntilFirstFrameRasterized();
connected = true;
} catch (error) {}
}
return driver;
}
@yanzisu68
Copy link

thank you really help me out!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment