Save a memory image (such as Uint8list) as image file in flutter


I have some Uint8lists and I wanna save them as jpg files.
I searched a lot for this on the web but found nothing!
Anyone can help?



By ‘storage’, do you mean write to a file? You don’t really need "flutter" to do this. Just use the libraries provided by dart. Here is an example of downloading my gravatar which you can get as Uin8List and then saving it to a file.

import 'dart:io';
import 'dart:typed_data';

import 'package:http/http.dart' as http;

void main() {
  http.get('').then((response) {
    Uint8List bodyBytes = response.bodyBytes;

Answered By – lsiu

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published