Menu
CoddyTech

Images From the Web

Part of the Your First App section of Coddy's Flutter journey. Lesson 27 of 32.

Image.network shows a picture from a web address:

Image.network('https://picsum.photos/id/10/300/200')

The app downloads the picture while it runs, so it can appear a moment after the rest of the screen. A width: sets how wide it is drawn, and its height follows to keep its shape:

Image.network('https://picsum.photos/id/10/300/200', width: 150)

Pictures that ship inside the app itself use Image.asset. You will meet it when you build a project of your own.

challenge icon

Challenge

Easy

Show this picture above the caption, as the first child of the Column:

https://picsum.photos/id/237/300/200

Try it yourself

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Text('A good dog', style: TextStyle(fontSize: 24)),
            ],
          ),
        ),
      ),
    );
  }
}
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Your First App

Practice on your own: Online Flutter compiler