I was trying to do some performance profiling of our production app and I noticed a certain function was taking a lot more time than I expected (350ms vs 1ms), so I started to dig deeper. In doing so, it looked like if I changed that function from a
Future<String> to a
String with no other code changes (it could have been written as a
FutureOr), the execution time of that code branch reduced to expected levels.
I posted about this on Twitter and created a reproduction.
This code runs in a fresh Flutter app on iOS Simulator.
It almost looks like a flurry of concurrent Futures are queueing up and delaying other futures.