Display Blob as Image in Flutter

9,443

Solution 1

If anyone is interested, I found the solution:

Grab the blob from JSON:

var blob = yourJSONMapHere['yourJSONKeyHere'];

var image = BASE64.decode(blob); // image is a Uint8List

Now, use image in a Image.memory

new Container( child: new Image.memory(image));

This worked for me!

Solution 2

NOT FOUND!!! For ME.

var image = BASE64.decode(blob);

NOT FOUND!!! For ME.

I found the solution 2020 - October:

import 'dart:convert';
import 'dart:typed_data';

Grab the blob from JSON:

var blob = yourJSONMapHere['yourJSONKeyHere'];

Uint8List image = Base64Codec().decode(blob); // image is a Uint8List

Now, use image in a Image.memory

new Container( child: new Image.memory(image));

This worked for me!

Share:
9,443
Kyle Stokes
Author by

Kyle Stokes

Updated on December 03, 2022

Comments

  • Kyle Stokes
    Kyle Stokes over 1 year

    Does anyone know how to convert a Blob into an image with Flutter? It looks like the 'dart:html' library is not available in Flutter. Any help is appreciated. Thank you!