CodeBlanks Logo Icon CodeBlanks

Project structure

Learn the roles of the lib/, android/ and ios/ folders.

Project folders

A Flutter project is split into several folders. lib/ holds your Dart source code; this is your main workspace. android/ and ios/ contain platform-specific native code and settings; you rarely touch them. test/ hosts unit tests.

ilk_uygulama/
├── lib/
│   └── main.dart
├── android/
├── ios/
├── test/
└── pubspec.yaml

pubspec.yaml sections

In pubspec.yaml the dependencies section lists packages the project needs; dev_dependencies lists packages used only during development. The environment section sets the valid Dart SDK version range. After editing, run flutter pub get to download the packages.

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.6

dev_dependencies:
  flutter_test:
    sdk: flutter

environment:
  sdk: '>=3.0.0 <4.0.0'

Practice Print pubspec sections

In main, print two lines with print: dependencies paketler and dev_dependencies test.

Starter code

main.dart
void main() {
  // iki satır yazdır:
  // dependencies paketler
  // dev_dependencies test

}

Sample solution

main.dart
void main() {
  print('dependencies paketler');
  print('dev_dependencies test');
}

Expected output

dependencies paketler
dev_dependencies test

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which folder holds native Android code and settings?

  • src/
  • lib/
  • android/ Correct answer
  • native/

Explanation: The android/ folder holds Android native code and settings; lib/ is for Dart code.

2 Download dependencies

Question
flutter pub ____
Answer
flutter pub get

Explanation: flutter pub get downloads the dependencies listed in pubspec.yaml.

3 Folder roles

Term Meaning
lib/ Dart source code
android/ Android native code and settings
ios/ iOS native code and settings
test/ Unit tests

All lessons in Beginner