Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Uint8List from a Network image by url in Flutter?

Tags:

flutter

dart

I have the network url of image and I need to get Uint8List. How can I convert it? I check answers in like question, but those ways don't work. How to get a Flutter Uint8List from a Network Image?

like image 571
Andrey Molochko Avatar asked Dec 02 '22 09:12

Andrey Molochko


1 Answers

Try this:

Uint8List bytes = (await NetworkAssetBundle(Uri.parse(url)).load(url))
    .buffer
    .asUint8List();
like image 89
kaya Avatar answered Dec 19 '22 02:12

kaya