Writes to stdout and stderr used to be blocking, on all platforms. As part of a cleanup, this is now async/non-blocking as any other Streams in dart:io.
How do I update my code?
Most code should work just like it used to, except a a few cases when calling 'exit': If you are writing to stdout/stderr and calling exit immediately after, the writes to stdout and stderr may be lost. Instead, do the following:
Future.wait([stdout.close(), stderr.close()])
.then((_) => exit());
As stdout/stderr .close will make sure to flush any pending writes.
Why did this change happen?
Everything in dart:io was async, with the exception of stdout/stderr. This is now fixed.
When will the change take effect?
This
change landed in
r27811. It should be available in the next release.