I am building a flutter app for the first time. I figured out the initial error I was getting with yaml. Now my error is "Error detected in pubspec.yaml: No file or variants found for asset: assets/food.jpg.
Error building assets Finished with error: Gradle task assembleDebug failed with exit code 1"
I created a folder for the picture I am using named it 'assets' the pic is in the folder. yaml is not recognizing the folder. I guess the path is not correct.
flutter:
# The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets: - assets/food.jpg
The above code is what is on yaml.
Below is the code for android studio:
import 'package:flutter/material.dart';
main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
build(context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('EasyList'),
),
body: Card(child: Column(children: <Widget>[
Image.asset('assets/food.jpg'),
Text('Food Paradise')
],),),
),
);
}
}
Below is the error:
Error detected in pubspec.yaml: No file or variants found for asset: assets/food.jpg.
Error building assets Finished with error: Gradle task assembleDebug failed with exit code 1
I am trying to get the pic on to the app. Any suggestions?