title: how to simply fetch an url body as a string synchronously
body: <p>How would you simply implement this function:</p>
  
  <pre><code>String fetchUrlBodyAsString(String url) {
    ...
  }
  </code></pre>
  
  <p>Usage:</p>
  
  <pre><code>String schema = fetchUrlBodyAsString("http://json-schema.org/draft-04/schema#");
  </code></pre>
  
  <p>This thread <a href="https://stackoverflow.com/questions/18033151/using-dart-to-download-a-file/18044164#18044164">Using dart to download a file</a> explains a good way to get to the data from a main function. But if you try it you see that the real work happens after leaving main. I think that the synchronous function that I want to create is difficult using HttpClient because it is trying to get an async api to work synchronously. According to this thread that may not be possible: <a href="https://groups.google.com/a/dartlang.org/d/msg/misc/kAgayQyaPhQ/wonJ776_FGIJ" rel="nofollow noreferrer">https://groups.google.com/a/dartlang.org/d/msg/misc/kAgayQyaPhQ/wonJ776_FGIJ</a></p>
  
  <p>What is a Dart way to implement this in a non-browser/console setting?</p>