Directory Structure



Introduction

Keeping projects organized can be difficult when there are a lot of moving parts. Nylo tries to solve this with a simple project structure.


App Directories

All the app directories are listed inside the lib directory where your main.dart file runs.

  • app this folder includes any files relating to models, controllers and networking.

    • controllers Include your controllers here for your Widget pages.
    • models Create your model classes here.
    • networking Add any networking classes here for managing APIs or fetching data from the internet.
  • common this folder includes any files relating to files you'll commonly need to find such as pages, widgets and themes.

    • pages Include your Widgets here that you will use as Page's in your project. E.g. home_page.dart.
    • themes By default we include two themes here but you can add more if your project needs to support more.
    • widgets Any widgets you need to create can be inserted here like a date_picker_widget.dart file.
  • routes this folder includes any files relating to models, controllers and networking.

    • router.dart contains the router for your application.

Tip for larger projects

You can create subdirectories within these directories to manage things at a domain level you can follow the below pattern. e.g.

  • models/user/

    • user_model.dart
    • user_project_model.dart
  • controllers/user/

    • profile_controller.dart
    • settings_controller.dart


Public assets

All public assets can be found in public/assets. This directory is commonly used for images, fonts and more files that you may want to include in your project.

{info} It's important to add any new files into the pubspec.yaml file too.

  • app_icon This is used for generating app_icons for the project.
  • images Include any images here in this directory.
  • fonts Add any custom fonts here.