Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not a valid Dart package name - Flutter error

I want my app to be available for the web.

I run this command: flutter create .

I get this error: "Fredi" is not a valid Dart package name.

I know that there shouldn't be any capital letters. However, I do not know how to change the dart package name.

I have already used these packages successfully, but they seem to be changing other things, not the Dart Package Name.

change_app_package_name: ^1.1.0
rename: ^2.0.1

The only thing in my project with the name 'Fredi' is the root folder (original project name). However, I don't know how to change it (file explorer won't let me) and it will probably break things.

What step can I take?

Config Files

app/build.gradle -> applicationId "com.tomasward.fredi"

android manifest -> package="com.tomasward.fredi"

android manifest -> android:label="Fredi"> [I understand this is the name displayed to the user, I've tried changing it but it doesn't fix the error.]

like image 271
Tomas Ward Avatar asked Jun 08 '26 07:06

Tomas Ward


1 Answers

You can run flutter create --project-name "your_valid_package_name" InvalidPackageNameDirectory to create a Flutter project in a directory with a non-valid package name.

In an already existing project, you can change the package name by modifying the name property in the pubspec.yaml at the root of the project (see here for more details on the pubspec).

like image 189
Ben Konyi Avatar answered Jun 10 '26 02:06

Ben Konyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!