4

Is there a way to set default package in VS Code? (com.example.myproject) I can only do this in Android studio. So I used it to create a project and then I open it in VS Code.

I mean when creating via: (Ctrl+Shift+P ➡ New flutter project)

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
GusZL
  • 73
  • 1
  • 8

2 Answers2

12

To change the default organization from com.example to your own, perform the following steps:

  1. Open Settings in VS Code
  2. Type "flutter" in the search bar
  3. Select Dart & Flutter under Extensions
  4. Scroll down to Dart: Flutter Create Organization
  5. Click Edit in settings.json
  6. Add the following line to the JSON list:

    "dart.flutterCreateOrganization": "com.mydomain",
    
  7. Save the file and create a new project

Your package name should be correct now and you can confirm it like this.

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
1

You can set the dart.flutterCreateOrganization setting to control the Organization used when building the identifier (it has the project name added to the end):

https://dartcode.org/docs/settings/#dartfluttercreateorganization

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275