title: How to get ByteData from a File
body: <p>I want to convert a <code>File</code> to a <code>ByteData</code> object in flutter.
  Something like this:</p>
  
  <pre><code>import 'dart:io';
  File file = getSomeCorrectFile(); //This file is correct
  ByteData bytes = ByteData(file.readAsBytesSync()); //Doesnt compile
  return bytes; 
  </code></pre>
  
  <p>I understood that <code>ByteData</code> constructor receives the length of the amount of bytes and initialize them with 0, so I could do something like <code>ByteData(file.readAsBytesStync().length);</code> but then how do I fill them?
  What am I missing?</p>