Sub topic 2
The `android` and `ios` Folders You Will Edit
Assume that you know basic Dart and Flutter development, can use a terminal, and have the Flutter SDK installed. This chapter focuses on the platform folders inside a Flutter project. You will use them when Flutter needs settings that Dart code cannot provide.
What the platform folders do
A Flutter project contains shared Dart code and a small native host for each target platform:
android/contains the Android Gradle project.ios/contains the Xcode project for iPhone and iPad.lib/contains most of the Flutter application code.pubspec.yamldescribes Dart packages, assets, and the application version.
The native host starts the Flutter engine and connects platform-specific settings to the Flutter application. You usually write features in lib/, but you edit android/ or ios/ for application identity, permissions, signing, native plugins, and release settings.
The files you will commonly inspect
The exact files depend on your Flutter version and whether the project uses Gradle Groovy or Kotlin DSL. Treat the generated platform projects as real source code. Keep important changes in version control.
| Folder or file | Purpose | Common release-related change |
|---|---|---|
| `android/app/` | Android application module | Application ID, resources, signing |
| `android/app/src/main/` | Android app resources and manifest | Permissions, app label, launcher icon |
| `android/gradle/` | Gradle wrapper support | Android build tooling |
| `ios/Runner/` | Main iOS application target | Bundle settings, native resources |
| `ios/Runner/Info.plist` | iOS application metadata | Permissions and supported capabilities |
| `ios/Runner.xcodeproj` | Xcode project settings | Target configuration and build settings |
| `ios/Runner.xcworkspace` | Xcode workspace | CocoaPods-integrated iOS builds |
You can inspect the platform files from the project root:
find android -maxdepth 3 -type f | sort
find ios -maxdepth 2 -type f | sortAndroid project boundaries
The Android application module is usually under android/app. Its manifest declares Android components and permissions. Resource directories contain launcher icons, strings, colors, and other native resources.
Build configuration is commonly split between:
- The project-level Gradle files, which define shared build tooling.
- The app-level Gradle file, which defines the application module.
gradle.properties, which contains Gradle options.key.properties, if you use a local Android signing configuration.
Do not commit passwords, private keys, or key.properties containing secrets. The application ID and release signing configuration are related to publishing, but they are separate settings. The application ID identifies the Android package. The signing key proves that an update comes from the same publisher.
iOS project boundaries
The ios/Runner directory contains the iOS target's source files and resources. Info.plist describes metadata such as display name and permission explanations. The Xcode project stores target settings, while the workspace includes dependencies managed by CocoaPods.
Open the workspace rather than only the project when CocoaPods is used:
open ios/Runner.xcworkspaceIn Xcode, select the Runner target to inspect its bundle identifier, signing team, capabilities, and build configurations. Provisioning profiles and certificates are managed through Xcode and Apple Developer settings, not through Dart code.
Files you should not edit casually
Avoid changing generated or dependency-owned directories such as android/.gradle, android/app/build, ios/Pods, and ios/build. These directories can be recreated. Change the project configuration or dependency declaration instead.
When a plugin requires native setup, follow its documented instructions and make the smallest change in the platform project. Afterward, run a clean build on the affected platform.
Exercise
Where should you change a permission required by an Android plugin: lib/, android/app/src/main/AndroidManifest.xml, or ios/Runner/Info.plist?
Show answer
Add the Android permission to android/app/src/main/AndroidManifest.xml. An iOS permission would use ios/Runner/Info.plist; Dart code alone does not declare either platform permission.