Skip to content

Instantly share code, notes, and snippets.

@chunhunghan
Created November 25, 2019 02:08
Show Gist options
  • Select an option

  • Save chunhunghan/5e822a6d2c440f0376415860887e5074 to your computer and use it in GitHub Desktop.

Select an option

Save chunhunghan/5e822a6d2c440f0376415860887e5074 to your computer and use it in GitHub Desktop.
Future<ui.Image> load(String asset) async {
ByteData data = await rootBundle.load(asset);
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
ui.FrameInfo fi = await codec.getNextFrame();
return fi.image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment