How can I get a Uint8List image size?

2,471

try this,

print(uint8ListImage.lengthInBytes);

this will print the size in bytes

Share:
2,471
Axes Grinds
Author by

Axes Grinds

Updated on December 13, 2022

Comments

  • Axes Grinds
    Axes Grinds over 1 year

    I want to find out the size of an Uint8List image before I upload it to firebase storage using

    StorageUploadTask uploadTask = reference.putData(uint8ListImage);
    

    wherein uint8ListImage is a Uint8List. Is there a way to find out the size of the Uint8List?

    • Claudio Redi
      Claudio Redi almost 4 years
      Size in bytes or in pixels? If you just need the size in bytes... then you just need uint8ListImage.length
    • Axes Grinds
      Axes Grinds almost 4 years
      yeah, I need just size in bytes. Can you post your comment as an answer so that I can accept it as the answer?