How to fetch an Image from Internet in Flutter

This Article is posted by seven.srikanth at 6/4/2019 5:05:36 PM



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












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