Search code examples
flutternetworkimageview

Invalid argument(s): No host specified in URI images/27567f904a64ba79ae95672e4ddf10c8.png


I want to retrieve the images from an api and I get this error. Can anyone help me? Thanks in advance. Note that I am on the localhost

CachedNetworkImage(
    imageUrl: AppConstants.BASE_URL +
        getCartHistoryList[listCounter - 1].img!,
),

Solution

  • First of all you are trying to fetch image using

    CachedNetworkImage

    which will takes

    imageUrl

    argument as a String and in

    https://

    format i.e. it should be a link Now come to the error part where error show

    images/27567... so on

    which is not the url link so first print this

    AppConstants.BASE_URL +
            getCartHistoryList[listCounter - 1].img!, 
    

    and you will get to know the reason and will solve that easily