Breaking Down Flutter Project File/Folders

In this post we will be breaking down flutter project file/folders. We learn about the use for each of them in Flutter app.

Introduction

When you first create a Flutter app with the flutter create project_name command, you will see quite a lot of files and folders generated out for you.

For a beginner, it might be confusing what these files are. So, in this post we are breaking down flutter project files/folders for you.

DecisionMentor app

Flutter Project Structure

Flutter Project Structure
Flutter Project Structure
  • .idea
    • The .idea folder contains your code editor’s project related settings specific files.
    • No need to make any manual changes here.
  • android
    • The android folder inside the Flutter project contains the Android platform specific settings, resources and code.
    • If you need to write any platform specific code, you will be making changes in here.
  • build
    • The build folder contains the output generated when you build or run the flutter project.
    • You will find all the the release related files/folders like apks and app bundles in here.
  • ios
    • Similar to android folder, the ios folder contains iOs specific settings, resources and code.
    • You will make the platform specific code or changes in here.
  • lib
    • The lib folder is main folder where you will write all the Flutter app related codes.
    • Initially it will contain just one single file main.dart which has the entry point for a Flutter app.
  • test
    • The test folder is set to contain any testing related codes that you write.
    • If you decide to write tests/test cases, you will be adding code in here.
  • .gitignore
    • This is a git specific file.
    • You can adjust the .gitignore file to include/exclude any files/folders as your need.
  • .metadata
    • As name suggests, the .metadata file contains Flutter project related metadata that Flutter tool uses.
    • You should not make any manual changes to this file.
  • .packages
    • A Flutter project code is composed of numerous libraries and packages.
    • Some packages are pre-installed with Flutter while others are downloaded during development.
    • The .packages holds the paths to each of the libraries/packages in your local computer.
    • You do not need to make any manual changes to this file.
  • expense_manager.iml
    • The .iml file is again android project specific file that contains information about JAVA module.
    • No need to make any changes here.
  • pubspec.lock
    • The pubspec.lock file is a helper file created next to puspec.yaml file.
    • It lists the specific versions of each dependency that packages use in your app and ensures the version stays consistent across different developers machine.
    • No need to make any changes here.
  • pubspec.yaml
    • The pubspec.yaml contains Flutter app specific metadata and configurations.
    • You can configure dependencies such as external packages, image assets, font files, app versions etc. with the help of this file.
    • You will often make changes to the pubspec.yaml file to add external dependencies.
  • README.md
    • The readme.md is a markdown format file which is primarily used to describe your project in git repo.
    • You can write project specific things like what your project does or how to use certain libraries in the README.md file.

Learn More:Flutter Tutorials