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.
- Period
- Jan 2024 – Feb 2024
- Technologies
- 4
- Diagrams
- 1
- Reading time
- 2 min
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.
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.
Related projects
Flutter Instagram clone: an offline-first architecture study
A guided rebuild of an open-source, multi-package Flutter app to study offline-first sync, modular design and server-driven UI.
FlutterDartBLoCSupabase / Postgres+1HelloZ: social-dating app on Flutter and Firebase
A full-stack social-dating product: Flutter app, TypeScript Cloud Functions, Firestore, presence, push and Play Billing.
FlutterDartBLoCFirebase+3Python Clean Architecture project scaffolder
A recursive Python script that builds a full Clean Architecture project tree from a nested dictionary and is safe to re-run.
PythonCode generationWant to discuss this project?
Happy to walk through the architecture, trade-offs or the code.