Loading Image From Http Url Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 12-10-2020

Image.network() is used to display image from internet in Flutter. The image widget has its own method .network() which will automatically loads image on calling time if mobile network is present. This function will automatically determines the mobile network and WiFi network and loads the image.

Loading Image From Http Url Using Flutter Android App

Loading Image From Http Url 
Complete Code For Loading Image From Http Url  In Flutter
Main.dart

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
        home: Scaffold(
          backgroundColor: Colors.black,
            appBar: AppBar(
              backgroundColor: Color(0xFF4527A0),
              title: Text('Show Image from URL'),
            ),
            body:Center(
              child:  Padding(
                padding: const EdgeInsets.only(top:60.0),
                child: Column(
                  children: [
                    Image.network('https://flutter-examples.com/wp-content/uploads/2020/02/dice.jpg',
                      width: 300, height: 200, fit: BoxFit.contain,),
                    SizedBox(height: 20,),
                    Image.network('https://flutter-examples.com/wp-content/uploads/2020/02/dice.jpg',
                      width: 300, height: 200, fit: BoxFit.contain,),
                  ],

                ),
              ),
            )));
  }
}

Related Post