When print is used inside tests its content is added to the test report as a string of unicode \u0000 making the test reporting parser fail. This PR cleans removes non json content every line of the report.
Bug: https://github.com/flutter/flutter/issues/145553
This pull request fixes#143803 by taking advantage of Dart's null-aware operators.
And unlike `switch` expressions ([9 PRs](https://github.com/flutter/flutter/pull/143634) and counting), the Flutter codebase is already fantastic when it comes to null-aware coding. After refactoring the entire repo, all the changes involving `?.` and `??` can fit into a single pull request.