# Flutter Clean Architecture generator (v1 to v4)

> Every Flutter feature needs the same data, domain and presentation scaffolding. This script generates it, and it bootstrapped a production courier app.

URL: https://thuyavan.netlify.app/projects/flutter-clean-arch-generator
Updated: 2026-10-12

- Period: 2024-01 → 2024-02
- Technologies: Python, Code generation, Flutter, BLoC

## Problem

Every new Flutter feature in Clean Architecture needs the same 20+ folders (data / domain / presentation, DAOs, repositories, BLoC, pages) and many boilerplate files. Creating them by hand is slow and inconsistent between developers.

## Version comparison

Ver
File
Date
Lines
Input
What it creates
Change from previous

v1
FlutterFolderCreate.py
01-22
132
hard-coded lists
a fixed directory list + files from a {path: content} dict
first version: create_directory_structure + create_files

v2
FlutterFolderCreateParams.py
01-23
106
function params root_folder, keyword
feature-module template: data/{data_sources/local/dao, remote, models, repository}, domain/{entities, repository, usecase}, presentation/{bloc/<kw>/{local,remote}, pages/{<kw>_detail, home, saved_<kw>}, widgets}
parameterised by feature name

v3
featuresDirectoryParms.py
01-23
111
CLI python featuresDirectoryParms.py <root> <keyword> (sys.argv, usage check)
same template as v2 + starter files
usable from the terminal for any feature

v4
myTaskerFolderFileCreate.py
02-08
320
hard-coded full-app spec
whole app skeleton: config/{route, theme}, core/{constants, helper, resources, signalr, usecases, utils}, features/<app>/… with ~90 named files (DAOs per package state, Retrofit-style http/*_api.dart, clients/*, DTOs, models + .g.dart, request objects post/ put/, repositories, entities, BLoCs, pages)
moved from “one feature” to “complete project blueprint”

example/1/ (S15) holds a byte-identical copy of v4 (md5 0907…), its two run logs, FolderStructure.txt, main.dart, injection_container.dart and the generated config/ core/ features/ folders. example/1/DirectoryFinder.py is an empty file. Empty File - Project/ (94 empty files) is v4’s generated output tree.

## Shared design

Idempotent: existing files / folders are skipped and logged, never overwritten.

Non-clobbering logs: generate_file_name appends (1), (2) … so each run keeps its own log.

Per-item try/except so one bad path does not stop the run.

## Domain evidence

The v4 blueprint names a mytaxi feature with package entities and states (accepted / declined / picked-up / delivered DAOs, accept/decline/pickup/dropoff/deliver_package_request) and a signalr service. That is exactly the MyTasker delivery-driver domain (doc 010), built on the MyTaxi code base. It confirms the generator was written to bootstrap MyTasker.

## Relationship

v4’s layout became the base of the SoftClient Flutter starter template (P25, doc 028, Sep 2024). S04 DirectoryFinder.py (same folder, same day) is the reverse tool: it dumps an existing tree to text so it can be turned into a generator spec.

## Resume line

Automated Flutter Clean-Architecture scaffolding with a Python generator (feature-module CLI and full-app blueprint, idempotent with audit logs), used to bootstrap a production delivery app.
