Reputation: 1
[1. create directory : "assets" 2. create directory images inside "assets" and then put in image into it "me.png"
`
import 'package:flutter/material.dart';
void main() {
runApp(
const MyApp(),
);
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Scaffold(
backgroundColor: Colors.blue,
body: Center(
child: Image.asset('assets/images/me.png'),
),
),
),
);
}
}
Upvotes: 0
Views: 24
Reputation: 41
Here is the solution:
You have to modify pubspec.yaml
assets:
- assets/images/me.png
Upvotes: 0