I am getting an error that flutter is unable to load my image which is stored in the Images directory.
I checked the indentation for the pubspec.yaml file,
and also checked the similar question for the solution to the error but nothing seems to work.
below are images for the pubspec.yaml file and code.
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.greenAccent,
body: SafeArea(
child: Column(
children: [
CircleAvatar(
radius: 50.0,
backgroundImage: AssetImage('Images/xyz.jpg'),
)
],
),
),
),
);
}
}
if you could please let me know what am I doing wrong here, that would be very helpful.
Change your pubspecc.yaml file like below hope it help:
flutter:
assets:
- Images/
uses-material-design: true