title: Dart `File.writeAsString` or `File.writeAsBytes` hangs when run inside Flutter testWidgets widget test
body: <p><code>File.writeAsString</code> is hanging when I try to run inside a widget test ( my goal is to take a screenshot of the widget undertest using Repaint boundaries on test fail and save the png to a file, same like update golden files with running this command )</p>
  <pre><code>  testWidgets(&quot;Display correct greeting text and user firstname morning start&quot;,
        (WidgetTester _tester) async {
      print(&quot;Saving test widget&quot;);
  
      await File(&quot;test_generated_4.txt&quot;).writeAsString('some content');
      // code never reaches here
      print(&quot;Saved test widget&quot;);
    });
  </code></pre>