I know this question has been asked, I looked through all of them and couldn’t find a fix for my code.
This is the pubspec yaml, I think that where I might have the error
name: i_am_rich
description: fuck this shit
version: 1.0.0+1
environment:
sdk: '>=2.18.4 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
and this is the dart
void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
centerTitle: true,
title: Text('Shine bright like a'),
backgroundColor: Colors.blueGrey[900],
),
body: Center(
child: Image(
image: AssetImage('images/diamond.png'),
),
),
),
),
);
}
I tried fixing the indentations on the pubspec.yaml
, both manually and with tab, and a bunch of stuff from youtube videos, even the course I’m taking (not very good honestly), been trying to fix this for HOURS please help.
3
Answers
do it this way
first in your pupspect yamel
then refer to it like this:
dont forgot to create an assets folder like this
= Go to Terminal. and write these commands. "flutter clean " then " flutter pub get " sometimes flutter is like this. and make sure the image file is located in the root of project like the above person’s answer and not inside lib.