title: How to get ui.Image(dart:ui) from network image?
body: <p>I am trying to write an image to canvas using Picture recorder...</p>
  
  <p>drawImage requires dart:ui image </p>
  
  <p>I have successfully imported asset image but getting following error for network image:</p>
  
  <blockquote>
    <p>[VERBOSE-2:codec.cc(97)] Failed decoding image. Data is either
    invalid, or it is encoded using an unsupported format.</p>
    
    <p>[VERBOSE-2:shell.cc(186)] Dart Error: Unhandled exception: Exception:
    operation failed
    0      _rootHandleUncaughtError. (dart:async/zone.dart:1112:29)
    1      _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    2      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)</p>
  </blockquote>
  
  <p>code tried so far..</p>
  
  <pre><code>netImage.obtainKey(new ImageConfiguration()).then((val) {
    var load = netImage.load(val);
  
    load.addListener((listener, err) async {
      ImageInfo imageInfo;
      setState(() =&gt; imageInfo = listener);
  
      imageInfo.image.toByteData().then((ss) {
  
        Uint8List lst = new Uint8List.view(ss.buffer);
  
        ui.instantiateImageCodec(lst).then((val) {
          val.getNextFrame().then((vaal) {
            imagetoDraw = vaal.image;
          });
        });
      });
    });
  });
  </code></pre>