What is the root dir of your project ?
Answer
Overview
The root directory of a Flutter project is the top-level folder created when you run
text
flutter createtext
lib/Flutter Project Root Directory Structure
textmy_flutter_app/ ← Root directory ├── android/ ← Android native project │ ├── app/ │ │ └── build.gradle │ └── build.gradle ├── ios/ ← iOS native project │ ├── Runner/ │ └── Podfile ├── lib/ ← Your Dart/Flutter code │ └── main.dart ← App entry point ├── test/ ← Unit & widget tests ├── assets/ ← Images, fonts, files ├── web/ ← Flutter Web support ├── linux/ ← Flutter Linux support ├── macos/ ← Flutter macOS support ├── windows/ ← Flutter Windows support ├── pubspec.yaml ← Project config & dependencies ├── pubspec.lock ← Locked dependency versions ├── analysis_options.yaml ← Dart linting rules ├── README.md └── .gitignore
Key Files in Root
| File/Folder | Purpose |
|---|---|
text | App name, version, dependencies, assets |
text | All Dart source code |
text | Entry point ( text text |
text | Android native configuration |
text | iOS native configuration |
text | Test files (mirrors lib/ structure) |
text | Static resources (declared in pubspec.yaml) |
text | Generated Flutter/Dart tool config |
text | Generated build outputs (gitignored) |
pubspec.yaml — Heart of the Root
yamlname: my_flutter_app # Package name description: My Flutter app version: 1.0.0+1 # version+buildNumber environment: sdk: '>=3.0.0 <4.0.0' dependencies: flutter: sdk: flutter http: ^1.2.0 dio: ^5.4.0 dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 flutter: assets: - assets/images/ # Declared here, stored in root/assets/ - assets/icons/ fonts: - family: Roboto fonts: - asset: assets/fonts/Roboto-Regular.ttf
Checking Your Root Directory
bash# In terminal, run from root flutter pub get # Install dependencies flutter run # Run the app flutter test # Run tests flutter build apk # Build release APK # The root is wherever pubspec.yaml lives ls pubspec.yaml # Confirms you're in root
Root dir = the folder containing
. Everything — builds, dependencies, platform configs — is relative to this directory.textpubspec.yaml