Flutter:: Invalid argument(s): No host specified in URI file://image name












0















When trying to add images inside gridview.count Widget. Images are not getting loaded and getting flowing error in console.



Images are placed in local - asset Folder



body: center(
child:gridview.count(
crossaxiscount: 3,
childaspectratio: 1.0,
padding: const edgeinsets.all(4.0),
mainaxisspacing: 4.0,
crossaxisspacing: 4.0,
children: <string>[
'spinach_onion_salad.png',
'veggie.png',
].map<widget>((string url) {
return gridtile(
footer: gridtilebar(
title: text(url)
),
child: image.network(url, fit: boxfit.cover)
);
}).tolist(),
),
),


Error:



Error:: 
Reloaded 0 of 426 libraries in 937ms.
Reloaded 6 of 426 libraries in 1,338ms.
I/flutter (32327): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32327): The following ArgumentError was thrown resolving an image codec:

I/flutter (32327): Invalid argument(s): No host specified in URI file:///%20eggie.png
I/flutter (32327):
I/flutter (32327): When the exception was thrown, this was the stack:
I/flutter (32327): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2121:9)
I/flutter (32327): #1 _HttpClient.getUrl (dart:_http/http_impl.dart:2056:48)









share|improve this question




















  • 1





    Are the images local or via network? if they local use Image.assets("")

    – Ahmed
    Jan 2 at 3:08











  • Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:13











  • ok it is Image.asset("") let me check

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:15











  • yes Image.asset("")

    – Ahmed
    Jan 2 at 3:21











  • If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

    – Ajay Beniwal
    Jan 2 at 6:08


















0















When trying to add images inside gridview.count Widget. Images are not getting loaded and getting flowing error in console.



Images are placed in local - asset Folder



body: center(
child:gridview.count(
crossaxiscount: 3,
childaspectratio: 1.0,
padding: const edgeinsets.all(4.0),
mainaxisspacing: 4.0,
crossaxisspacing: 4.0,
children: <string>[
'spinach_onion_salad.png',
'veggie.png',
].map<widget>((string url) {
return gridtile(
footer: gridtilebar(
title: text(url)
),
child: image.network(url, fit: boxfit.cover)
);
}).tolist(),
),
),


Error:



Error:: 
Reloaded 0 of 426 libraries in 937ms.
Reloaded 6 of 426 libraries in 1,338ms.
I/flutter (32327): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32327): The following ArgumentError was thrown resolving an image codec:

I/flutter (32327): Invalid argument(s): No host specified in URI file:///%20eggie.png
I/flutter (32327):
I/flutter (32327): When the exception was thrown, this was the stack:
I/flutter (32327): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2121:9)
I/flutter (32327): #1 _HttpClient.getUrl (dart:_http/http_impl.dart:2056:48)









share|improve this question




















  • 1





    Are the images local or via network? if they local use Image.assets("")

    – Ahmed
    Jan 2 at 3:08











  • Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:13











  • ok it is Image.asset("") let me check

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:15











  • yes Image.asset("")

    – Ahmed
    Jan 2 at 3:21











  • If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

    – Ajay Beniwal
    Jan 2 at 6:08
















0












0








0








When trying to add images inside gridview.count Widget. Images are not getting loaded and getting flowing error in console.



Images are placed in local - asset Folder



body: center(
child:gridview.count(
crossaxiscount: 3,
childaspectratio: 1.0,
padding: const edgeinsets.all(4.0),
mainaxisspacing: 4.0,
crossaxisspacing: 4.0,
children: <string>[
'spinach_onion_salad.png',
'veggie.png',
].map<widget>((string url) {
return gridtile(
footer: gridtilebar(
title: text(url)
),
child: image.network(url, fit: boxfit.cover)
);
}).tolist(),
),
),


Error:



Error:: 
Reloaded 0 of 426 libraries in 937ms.
Reloaded 6 of 426 libraries in 1,338ms.
I/flutter (32327): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32327): The following ArgumentError was thrown resolving an image codec:

I/flutter (32327): Invalid argument(s): No host specified in URI file:///%20eggie.png
I/flutter (32327):
I/flutter (32327): When the exception was thrown, this was the stack:
I/flutter (32327): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2121:9)
I/flutter (32327): #1 _HttpClient.getUrl (dart:_http/http_impl.dart:2056:48)









share|improve this question
















When trying to add images inside gridview.count Widget. Images are not getting loaded and getting flowing error in console.



Images are placed in local - asset Folder



body: center(
child:gridview.count(
crossaxiscount: 3,
childaspectratio: 1.0,
padding: const edgeinsets.all(4.0),
mainaxisspacing: 4.0,
crossaxisspacing: 4.0,
children: <string>[
'spinach_onion_salad.png',
'veggie.png',
].map<widget>((string url) {
return gridtile(
footer: gridtilebar(
title: text(url)
),
child: image.network(url, fit: boxfit.cover)
);
}).tolist(),
),
),


Error:



Error:: 
Reloaded 0 of 426 libraries in 937ms.
Reloaded 6 of 426 libraries in 1,338ms.
I/flutter (32327): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32327): The following ArgumentError was thrown resolving an image codec:

I/flutter (32327): Invalid argument(s): No host specified in URI file:///%20eggie.png
I/flutter (32327):
I/flutter (32327): When the exception was thrown, this was the stack:
I/flutter (32327): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2121:9)
I/flutter (32327): #1 _HttpClient.getUrl (dart:_http/http_impl.dart:2056:48)






image dart flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 3:13







Nithyanandan Sathiyanathan

















asked Jan 2 at 3:04









Nithyanandan SathiyanathanNithyanandan Sathiyanathan

689622




689622








  • 1





    Are the images local or via network? if they local use Image.assets("")

    – Ahmed
    Jan 2 at 3:08











  • Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:13











  • ok it is Image.asset("") let me check

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:15











  • yes Image.asset("")

    – Ahmed
    Jan 2 at 3:21











  • If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

    – Ajay Beniwal
    Jan 2 at 6:08
















  • 1





    Are the images local or via network? if they local use Image.assets("")

    – Ahmed
    Jan 2 at 3:08











  • Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:13











  • ok it is Image.asset("") let me check

    – Nithyanandan Sathiyanathan
    Jan 2 at 3:15











  • yes Image.asset("")

    – Ahmed
    Jan 2 at 3:21











  • If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

    – Ajay Beniwal
    Jan 2 at 6:08










1




1





Are the images local or via network? if they local use Image.assets("")

– Ahmed
Jan 2 at 3:08





Are the images local or via network? if they local use Image.assets("")

– Ahmed
Jan 2 at 3:08













Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

– Nithyanandan Sathiyanathan
Jan 2 at 3:13





Images in local. but not able to add The class 'Image' doesn't have a constructor named 'assets'.

– Nithyanandan Sathiyanathan
Jan 2 at 3:13













ok it is Image.asset("") let me check

– Nithyanandan Sathiyanathan
Jan 2 at 3:15





ok it is Image.asset("") let me check

– Nithyanandan Sathiyanathan
Jan 2 at 3:15













yes Image.asset("")

– Ahmed
Jan 2 at 3:21





yes Image.asset("")

– Ahmed
Jan 2 at 3:21













If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

– Ajay Beniwal
Jan 2 at 6:08







If they are local images do not forget to add them to pubspec.yaml and use Image.asset method

– Ajay Beniwal
Jan 2 at 6:08














1 Answer
1






active

oldest

votes


















0














 return Container(
child: Center(
child: GridView.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
mainAxisSpacing: 4.0,
children: <String>[
'spinach_onion_salad.png',
'veggie.png',
]
.map<Widget>((String url) => GridTile(
footer: GridTileBar(title: Text(url)),
child: Image.asset(url)))
.toList(),
),
),
);





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000775%2fflutter-invalid-arguments-no-host-specified-in-uri-file-image-name%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














     return Container(
    child: Center(
    child: GridView.count(
    crossAxisCount: 3,
    childAspectRatio: 1.0,
    padding: const EdgeInsets.all(4.0),
    mainAxisSpacing: 4.0,
    children: <String>[
    'spinach_onion_salad.png',
    'veggie.png',
    ]
    .map<Widget>((String url) => GridTile(
    footer: GridTileBar(title: Text(url)),
    child: Image.asset(url)))
    .toList(),
    ),
    ),
    );





    share|improve this answer




























      0














       return Container(
      child: Center(
      child: GridView.count(
      crossAxisCount: 3,
      childAspectRatio: 1.0,
      padding: const EdgeInsets.all(4.0),
      mainAxisSpacing: 4.0,
      children: <String>[
      'spinach_onion_salad.png',
      'veggie.png',
      ]
      .map<Widget>((String url) => GridTile(
      footer: GridTileBar(title: Text(url)),
      child: Image.asset(url)))
      .toList(),
      ),
      ),
      );





      share|improve this answer


























        0












        0








        0







         return Container(
        child: Center(
        child: GridView.count(
        crossAxisCount: 3,
        childAspectRatio: 1.0,
        padding: const EdgeInsets.all(4.0),
        mainAxisSpacing: 4.0,
        children: <String>[
        'spinach_onion_salad.png',
        'veggie.png',
        ]
        .map<Widget>((String url) => GridTile(
        footer: GridTileBar(title: Text(url)),
        child: Image.asset(url)))
        .toList(),
        ),
        ),
        );





        share|improve this answer













         return Container(
        child: Center(
        child: GridView.count(
        crossAxisCount: 3,
        childAspectRatio: 1.0,
        padding: const EdgeInsets.all(4.0),
        mainAxisSpacing: 4.0,
        children: <String>[
        'spinach_onion_salad.png',
        'veggie.png',
        ]
        .map<Widget>((String url) => GridTile(
        footer: GridTileBar(title: Text(url)),
        child: Image.asset(url)))
        .toList(),
        ),
        ),
        );






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 3:20









        AhmedAhmed

        43137




        43137
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000775%2fflutter-invalid-arguments-no-host-specified-in-uri-file-image-name%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

            ts Property 'filter' does not exist on type '{}'

            Notepad++ export/extract a list of installed plugins