开发者

network image showing in flutter web but not showing in mobile flutter

When i run flutter in web with command

flutter run -d chrome --web-renderer html --no-sound-null-safety

Network Image show in flutter web but when i run in mobile it not show 3

Error :

======== Exception caught by image resource service ================================================
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 403, https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg

When the exception was thrown, this was the stack: 
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:117:9)
<asynchronous suspension>
Image provider: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
Image key: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
====================================================================================================

When i open the image url in the browser image shows perfectly. My image show code is

SizedBox(
  height: MediaQuery.of(context).size.height * 0.1,
  width: MediaQuery.of(context).size.height * 0.1,
  child: FadeInImage(
    placeholder: const AssetImage("assets/logo.png"),
    image: NetworkImage(
      productImage,
    ),
  ),
),

My manifest code

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="开发者_运维问答http://schemas.android.com/tools"
    package="com.znindia.stock">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Calling in list view

return ProductWidget(
  context,
  productId: products[index][0],
  productImage: products[index][8],
  productName: products[index][1],
  onDeleteOptionClick: () {
    deleteProduct(
      id: products[index][0],
      name: products[index][1],
      categoryId: products[index][2],
      brandId: products[index][3],
      qty: products[index][4],
      purchasePrice: products[index][5],
      salePrice: products[index][6],
      hsnCode: products[index][7],
      image: products[index][8],
      tax: products[index][9],
    );
  },
);

and ProductWidget is

ProductWidget(context,
    {required int productId,
    required String productImage,
    required String productName,
    required VoidCallback onDeleteOptionClick}) {
  return buildCustomButtonCard(
    Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        SizedBox(
          width: MediaQuery.of(context).size.width * 0.20,
          child: (productImage == "")
              ? Container()
              : SizedBox(
                  height: MediaQuery.of(context).size.height * 0.1,
                  width: MediaQuery.of(context).size.height * 0.1,
                  child: Image.network(
                    productImage,
                  ),
                ),


//try this Image.network
Image.network('https://shop.znindia.com/public/uploads/all/mf1Ska5QL4SvVpxsnQvyCi4qI2E59l9oG49kJxntscFNuKvlwQ.jpg')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜