title: How can I draw a image loaded from an asset on a Canvas object
body: <p>I'm toying with Flutter and I have implemented a custom-drawn widget using <code>CustomPainter</code> class. </p>
  
  <p>Primitives are quite well documented. However, it seems that there's <code>Image</code> (the widget) and <code>Image</code> (the data structure), because if I istantiate an <code>Image</code> (the widget) I cannot pass it to the Canvas method <code>drawImage</code> because it needs another type of <code>Image</code>. </p>
  
  <p>Problem is, I cannot wrap my head on how to load a resource into an <code>Image</code> data structure. </p>
  
  <p>Has anyone tackled this problem? </p>
  
  <p>[edit] Thanks to <strong>rmtmckenzie</strong> I solved it this way:</p>
  
  <pre><code>rootBundle.load("assets/galaxy.jpg").then( (bd) {
    Uint8List lst = new Uint8List.view(bd.buffer);
    UI.instantiateImageCodec(lst).then( (codec) {
      codec.getNextFrame().then(
        (frameInfo) {
          bkImage = frameInfo.image;
          print ("bkImage instantiated: $bkImage");
          }
        }
      );
    });
  });
  </code></pre>