How to save a Flutter canvas as a bitmap image?

后端 未结 1 496
礼貌的吻别
礼貌的吻别 2021-01-01 05:50

I have a Flutter canvas , and I\'d like to save that canvas as a bitmap image (e.g. PNG, but any common bitmap format will do). What\'s the best way to get the bits out of a

相关标签:
1条回答
  • 2021-01-01 06:44
    1. Create a PictureRecorder.
    2. Create a Canvas with your PictureRecorder and draw stuff.
    3. Call endRecording() on the PictureRecorder to get a Picture.
    4. Call toImage() on the Picture.
    5. Call toByteData() on the Image. Oops, this isn't implemented yet. I filed an issue.
    0 讨论(0)
提交回复
热议问题