2

I created demo project in Flutter, and the package name:

iOS : com.example.flutterAppTest

Android : com.example.flutter_app_test

Why they are different? Should they need to be different?

What is the practice for package names for cross platform?

Pat. ANDRIA
  • 2,330
  • 1
  • 13
  • 27
Pavel Poley
  • 5,307
  • 4
  • 35
  • 66

1 Answers1

3

Following Java package naming conventions the reason for underscores for the Android package name is:

Naming Conventions

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

For iOS, many people use camelCase. The same case was used your iOS bundle ID or package name but there is no strict rule which case to use. This is only a convention and not a compiler rule.

Valid names consist of letters (lower or upper case), digits, underscores and start from a letter or underscore.

Should they need to be different?

Each platform follows its own conventions but there is no need for them to be different. As aforementioned - you can rename package as you wish using letters, digits and underscores.

What is the practice for package names for cross platform?

If possible - you can use the same package name but it will violate conventions, which is not desirable.

If not possible (e.g. project does not compile) - follow the rules.

IMHO, following conventions (as the also follow the rules) is the best solution.

You can find more information here about Java package naming conventions (this is a different resource).

Jenea Vranceanu
  • 4,530
  • 2
  • 18
  • 34