How to fetch an Image from Internet in Flutter

This Article is posted by seven.srikanth at 04-06-2019 17:05:36

Here is a simple example of how to fetch an image from the internet in flutter. 

This is how the image is going to look in your app. You can style it as appropriate. 


Here is the code from main.dart file, in order to run this code, copy this to main.dart file for your newly created flutter project.

import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Image.network('https://images.unsplash.com/photo-1517694712202-14dd9538aa97?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60'),
);
}
}

Hope example is useful to you.

You might find this below articles useful. 

ListView with Images from the Internet - https://fluttercentral.com/Articles/Post/1145
How to add List of Images into a Flutter Project? - https://fluttercentral.com/Articles/Post/37

Thanks,
Srikanth

Tags: Image from Internet; Images from Internet; fetch from internet; Simple example in flutter;



0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.



Recent Articles


How to deploy flutter web site on GitHub using peanut

Posted by nikhilchaudhary12155 on 13 Oct 2019 Article


AnimatedPositioned Widget Example in Flutter

Posted by seven.srikanth on 10 Oct 2019 Article


Flutter Open-Source and directory lists

Posted by nishantkotatech on 09 Oct 2019 Article


Flutter Travelling Couple Leading Page - Flutter Web Series 3

Posted by nikhilchaudhary12155 on 05 Oct 2019 Article



© 2018 - Fluttercentral | Email to me - Seven.srikanth@gmail.com