skip to content

With flutter create, how do you start an app for Android, iOS and web only, and what do --org and --platforms control?

level: juniorimportance: must knowfreq 62%

answer

  1. reverse-domain prefix, default com.example
  2. folder name becomes the package name
  3. one platform folder per target
  4. underscores on Android, camelCase on Apple
  5. re-run create to add a platform

basics

~10 s

Run flutter create --org com.acme --platforms android,ios,web shop_app. --org sets the reverse-domain prefix of the Android application ID and iOS bundle ID; --platforms decides which platform folders are generated.

solid answer

~40 s

`flutter create --org com.acme --platforms android,ios,web shop_app` makes a project named after the folder, which must be a valid Dart package name. `--org` (default `com.example`) is the reverse-domain prefix for the platform identifiers: Android gets `com.acme.shop_app`, while iOS gets a camelCased bundle ID, `com.acme.shopApp`. `--platforms` lists the targets whose folders are generated; without it every enabled platform gets one. Other useful switches: `--empty` for a minimal `main.dart` without the counter demo or its widget test, `-t` for `app`, `module`, `package`, `package_ffi` or `plugin`, and `--android-language` (Kotlin by default). Running `flutter create --platforms macos .` later inside the project adds a platform and reuses the existing organisation.

code

bash · 6 lines
bash
flutter create --org com.acme --platforms android,ios,web --empty shop_app
cd shop_app
# android/app/build.gradle.kts -> applicationId = "com.acme.shop_app"
# ios/Runner.xcodeproj      -> PRODUCT_BUNDLE_IDENTIFIER = com.acme.shopApp

flutter create --platforms macos .   # later: add macOS; org is read from existing files

go deeper

for a junior

Know the create command with --org and --platforms, that the folder name becomes the package name, and what --empty gives you.

for a middle

Explain how --org becomes each platform's identifier, why iOS and Android differ, and how re-running create adds a platform without touching existing files.

for a senior

Choose identifiers and platforms up front, knowing their cost to change later, and pick the right template: app, module, package, plugin or package_ffi.

for a principal

Set the team's project bootstrap standard: identifier scheme, target platforms, and whether new apps start from create --empty or an internal template.

## The command and its result ```bash flutter create --org com.acme --platforms android,ios,web shop_app ``` This creates a `shop_app/` directory holding a Flutter **application** (the default template): `lib/main.dart`, `pubspec.yaml`, `analysis_options.yaml`, a `test/` folder and one folder per requested platform — here `android/`, `ios/` and `web/`. By default it then runs `flutter pub get` (`--no-pub` skips that). The **project name** comes from the directory name unless you pass `--project-name`. It must be a valid Dart package name: lowercase words joined by underscores, not starting with a digit, not a reserved word. `flutter create ShopApp` fails and suggests a valid alternative. ## What --org controls `--org` takes the organisation in **reverse domain notation** and defaults to `com.example`. The tool combines it with the project name into each platform's identifier, and each platform has its own character rules: | Platform | Identifier built | Example for `com.acme` + `shop_app` | |---|---|---| | Android (application ID and Kotlin package) | org + name, underscores kept | `com.acme.shop_app` | | iOS and macOS (bundle identifier) | org + name in camelCase | `com.acme.shopApp` | | Linux | same scheme as Android | `com.acme.shop_app` | Two consequences interviewers like: - The Android and iOS identifiers **differ by default**. If the stores or a backend expect one identical string, change it in the platform projects deliberately. - Shipping with `com.example` is a mistake; store consoles reject or flag it. Choose `--org` at creation time, because changing it later means editing Gradle files, Xcode settings and package paths by hand. ## What --platforms controls `--platforms` (alias `--platform`) accepts `ios`, `android`, `windows`, `linux`, `macos` and `web`, plus `darwin` for plugins that share iOS and macOS code. Without it, the tool generates **every platform enabled** in the Flutter configuration. A platform whose feature is disabled with `flutter config` is skipped even if requested. The platform folders matter beyond the build: `flutter run` treats a device as usable **only if the project has that platform's folder**. With `android,ios,web`, a macOS desktop device is listed as found but not supported by this project. To add a platform later: 1. `cd shop_app` 2. `flutter create --platforms macos .` Re-running `create` on an existing project **repairs** it: it recreates missing files and leaves existing ones alone unless you pass `--overwrite`. When `--org` is omitted, it reads the organisation from the existing platform files, and stops if they disagree. ## Templates and other switches - **`-t app`** (default) — a runnable application. - **`-t module`** — a Flutter module to embed in an existing Android or iOS app. - **`-t package`** — shareable Dart code with no native parts. - **`-t plugin`** — a Dart API with platform implementations reached through method channels. - **`-t package_ffi`** — native code bound through `dart:ffi`; the older `plugin_ffi` template is deprecated in its favour. - **`--empty` / `-e`** — the app template with a minimal `main.dart` and no widget test; valid only for `app`. - **`--android-language`** — `kotlin` (default) or `java`. The old `--ios-language` option is deprecated and has no effect; generated iOS code is always Swift. - **`--description`** — the `description` written into `pubspec.yaml`. ## A sensible sequence 1. Decide the organisation and the real target platforms before running `create`. 2. Create with `--org`, `--platforms` and usually `--empty`. 3. Commit the result before adding anything, so later template changes show up as diffs.

  • Why are the Android and iOS identifiers different for the same --org and project name?
    Each platform has its own identifier rules. The tool keeps underscores for Android and Linux (`com.acme.shop_app`) but converts the name to camelCase and strips disallowed characters for Apple bundle identifiers (`com.acme.shopApp`). If you need one identical identifier everywhere, change it in the platform projects deliberately.
  • What happens if you run flutter create in a directory that already contains a Flutter project?
    It repairs the project: missing files, including folders for newly requested platforms, are recreated, and existing files are left alone unless `--overwrite` is passed. Without `--org`, the organisation is read from the existing platform files, and the tool stops if they disagree.

saying these in an interview costs you the question

  • Leaves --org at com.example for an app headed to the stores
  • Assumes Android and iOS always get identical identifiers
  • Names the project folder with capitals or hyphens
  • Deletes and recreates the project to add a platform
  • Thinks --ios-language objc still generates Objective-C code