How to create an "Asset" Vscode directory in a Flutter project

Asked

Viewed 161 times

-2

I’m starting to learn Flutter and, I need to create an "Assets" directory at the root of the flutter project in Vscode, but I can’t, just give me the option to create new Files and new folders.

if anyone can help me I appreciate!

  • Hi Marcio, try to bring more details of how you try to accomplish this creation

  • I created a folder, but it is created as a subfolder and not as a root folder, and I could not make it work, even fitting the pubspec_yaml, putting the path, then the flutter did not seek the images

1 answer

2

Just create a folder and name it as Assets.

Remember that in Flutter you need to edit the pubspec.yaml file by adding the folder name there and be careful with the indentation otherwise it gives problem:

# To add assets to your application, add an assets section, like this:
  assets:
    - assets/cifrao.png
  #   - images/a_dot_ham.jpeg

You will also need an extension called Pubspec assist. In Android Studio there is a button to update dependencies but in VS Code there is no.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.