Search
[Flutter/dart] How to convert between images and Uint8List
- M.R

 - Oct 16, 2021
 - 1 min read
 
Overview
A library called image is useful when editing images with flutter.
This library uses image data in the type Uint8List when dealing with images.
So, this time, I will introduce how to read an image and convert it to Uint8List, and how to save Uint8List data as an image.
Method
Here's how to read an image and convert it to a Uint8List.
import 'dart:io' as io;
await io.File(imgPath).readAsBytes();Conversely, the method for saving Uint8List type data as an image is as follows.
await io.File(savePath).writeAsBytes(imgBytes);





Comments