Bird
Raised Fist0
Fluttermobile~15 mins

Flutter project structure - Mini App: Build & Ship

Choose your learning style10 modes available
Build: Project Structure Overview
This screen shows the main folders and files of a Flutter project with simple descriptions.
Target UI
Flutter Project Structure

- android/       (Android native code)
- ios/           (iOS native code)
- lib/           (Dart code folder)
  - main.dart    (App entry point)
- test/          (Test files)
- pubspec.yaml   (Project config and dependencies)
Display a vertical list of main Flutter project folders and files
Each item shows the name and a short description
Use simple text widgets with clear spacing
Screen has a title at the top
Starter Code
Flutter
import 'package:flutter/material.dart';

class ProjectStructureScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Project Structure'),
      ),
      body: Padding(
        padding: EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            // TODO: Add list of folders and files here
          ],
        ),
      ),
    );
  }
}
Task 1
Task 2
Task 3
Solution
Flutter
import 'package:flutter/material.dart';

class ProjectStructureScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Project Structure'),
      ),
      body: Padding(
        padding: EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('android/', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
            SizedBox(height: 4),
            Text('Android native code', style: TextStyle(color: Colors.grey[700])),
            SizedBox(height: 16),
            Text('ios/', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
            SizedBox(height: 4),
            Text('iOS native code', style: TextStyle(color: Colors.grey[700])),
            SizedBox(height: 16),
            Text('lib/', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
            SizedBox(height: 4),
            Text('Dart code folder', style: TextStyle(color: Colors.grey[700])),
            SizedBox(height: 8),
            Padding(
              padding: EdgeInsets.only(left: 16),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('main.dart', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
                  SizedBox(height: 2),
                  Text('App entry point', style: TextStyle(color: Colors.grey[700])),
                ],
              ),
            ),
            SizedBox(height: 16),
            Text('test/', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
            SizedBox(height: 4),
            Text('Test files', style: TextStyle(color: Colors.grey[700])),
            SizedBox(height: 16),
            Text('pubspec.yaml', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
            SizedBox(height: 4),
            Text('Project config and dependencies', style: TextStyle(color: Colors.grey[700])),
          ],
        ),
      ),
    );
  }
}

This screen uses a Column to list the main folders and files of a Flutter project.

Each item has a bold title and a smaller description below it with some spacing for clarity.

The Padding widget adds space around the content so it doesn't touch screen edges.

This simple layout helps beginners understand the basic Flutter project structure visually.

Final Result
Completed Screen
Flutter Project Structure

android/
  Android native code

ios/
  iOS native code

lib/
  Dart code folder
    main.dart
      App entry point

test/
  Test files

pubspec.yaml
  Project config and dependencies
Screen shows a scrollable list of project folders and files
User can read folder names and their descriptions clearly
Stretch Goal
Make the list scrollable for smaller screens
💡 Hint
Wrap the Column inside a SingleChildScrollView widget

Practice

(1/5)
1. Which folder in a Flutter project contains the main Dart code for your app?
easy
A. lib/
B. android/
C. ios/
D. test/

Solution

  1. Step 1: Identify the folder purpose

    The lib/ folder is where Dart code for the app lives.
  2. Step 2: Compare with other folders

    android/ and ios/ hold platform-specific files, test/ holds tests.
  3. Final Answer:

    lib/ -> Option A
  4. Quick Check:

    Main Dart code folder = lib/ [OK]
Hint: Main app code is always in lib/ folder [OK]
Common Mistakes:
  • Confusing android/ with code folder
  • Thinking test/ holds main code
  • Mixing ios/ with Dart code
2. Which file manages app dependencies and assets in a Flutter project?
easy
A. main.dart
B. pubspec.yaml
C. build.gradle
D. AndroidManifest.xml

Solution

  1. Step 1: Understand file roles

    pubspec.yaml is the config file for dependencies and assets.
  2. Step 2: Differentiate from other files

    main.dart is code, build.gradle is Android build config, AndroidManifest.xml is Android app manifest.
  3. Final Answer:

    pubspec.yaml -> Option B
  4. Quick Check:

    Dependencies and assets file = pubspec.yaml [OK]
Hint: pubspec.yaml always manages dependencies and assets [OK]
Common Mistakes:
  • Choosing main.dart as config file
  • Confusing build.gradle with Flutter config
  • Mixing AndroidManifest.xml with Flutter dependencies
3. What will happen if you put your test files inside the lib/ folder instead of test/?
medium
A. Tests will automatically move to test/ folder
B. Tests will run normally without issues
C. App will fail to compile due to test files
D. Tests may be included in the app build, increasing size

Solution

  1. Step 1: Understand folder roles

    lib/ is for app code; test/ is for tests only.
  2. Step 2: Consequence of wrong placement

    Putting tests in lib/ includes them in app build, increasing size unnecessarily.
  3. Final Answer:

    Tests may be included in the app build, increasing size -> Option D
  4. Quick Check:

    Tests in lib/ increase app size [OK]
Hint: Keep tests only in test/ folder to avoid bloated app [OK]
Common Mistakes:
  • Assuming tests run normally in lib/
  • Thinking app will fail to compile
  • Believing tests auto-move folders
4. You accidentally deleted the android/ folder in your Flutter project. What is the likely result?
medium
A. The iOS build will fail instead
B. The app will still build and run on Android devices
C. You will get errors when building for Android platform
D. Flutter will recreate the android/ folder automatically

Solution

  1. Step 1: Role of android/ folder

    The android/ folder contains platform-specific files needed to build Android apps.
  2. Step 2: Effect of deletion

    Deleting it causes build errors when targeting Android because required files are missing.
  3. Final Answer:

    You will get errors when building for Android platform -> Option C
  4. Quick Check:

    Missing android/ folder causes Android build errors [OK]
Hint: android/ folder is essential for Android builds [OK]
Common Mistakes:
  • Assuming app runs without android/ folder
  • Thinking iOS build is affected
  • Believing Flutter auto-recreates android/
5. You want to add a new image asset to your Flutter app. Which two steps must you do to use it correctly?
hard
A. Place the image in assets/ folder and declare it in pubspec.yaml
B. Place the image in android/ folder and import it in main.dart
C. Place the image in lib/ and add it to pubspec.yaml
D. Place the image in test/ folder and reference it in code

Solution

  1. Step 1: Store image in assets/ folder

    Images should be placed in a dedicated folder like assets/ for organization.
  2. Step 2: Declare asset in pubspec.yaml

    You must list the image path under flutter/assets in pubspec.yaml to use it.
  3. Final Answer:

    Place the image in assets/ folder and declare it in pubspec.yaml -> Option A
  4. Quick Check:

    Assets folder + pubspec.yaml declaration = correct asset use [OK]
Hint: Always declare assets in pubspec.yaml after adding files [OK]
Common Mistakes:
  • Putting images in lib/ folder
  • Not declaring assets in pubspec.yaml
  • Placing images in android/ or test/ folders
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard