Originally posted https://easyflutter.com/display-images-locally-in-flutter/
As a part of flutter tutorial series, weβre going to learn how to display images locally in your flutter apps
Steps:
- Create new folder in your project called images
- Copy your images into images folder
- open your
pubspec.yaml
and enable access to images folder (watch video)
Source code:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'EasyFlutter',
home: Scaffold(
body: Center(
child: Image.asset(
"images/mypic.jpg",
height: 200.0,
width: 200.0,
),
),
),
);
}
}
Source code: https://easyflutter.com/display-images-locally-in-flutter/
Top comments (0)