Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter web Error while loading network image url

 Future<Uint8List> _loadNetworkImage(String imgname) async {
    try {
      final ByteData imageData = await NetworkAssetBundle(Uri.parse('https://picsum.photos/250?image=9')).load("");
      final Uint8List bytes = imageData.buffer.asUint8List();
      return bytes;
    } catch (_) {
      throw "Couldn't resolve network Image.";
    }
  }

when i run this code on flutter web i am getting this error i dont know why can anyone please help me.

Error: Couldn't resolve network Image.

like image 361
winston Jeyaseelan Avatar asked Sep 21 '26 21:09

winston Jeyaseelan


1 Answers

Uri uri = Uri.parse(filePath);
Uint8List fileData = await http.readBytes(uri);
like image 69
nexdev Avatar answered Sep 25 '26 14:09

nexdev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!