跪拜 Guibai
← All articles
Frontend · Architecture · Flutter

FlutterKit Ships a GetX Scaffold With 98% Test Coverage and AI-Ready Structure

By JokerX ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A Flutter scaffold with 98% line coverage and explicit AI-assistance files removes the first two weeks of project setup — networking, pagination, database, and navigation wiring — while giving AI coding tools enough structural context to generate features that respect the architecture rather than bypass it.

Summary

FlutterKit packages a full Flutter application skeleton around GetX, Dio, Retrofit, sqflite, and TDesign Flutter. It ships with seven core capability modules — network requests, paginated lists, state management, navigation, screen adaptation, local database, and lightweight storage — each backed by runnable demo pages and documented online. The architecture enforces a strict dependency direction: Feature modules depend on Core through Repository interfaces, never directly on network or database layers, and Core never references Feature code.

Every Core and Demo module carries unit tests with line coverage no lower than 98% and branch coverage no lower than 95%. The project also includes a project-level AGENTS.md and specialized Skills for UI, data, navigation, theming, and previews, explicitly designed so AI coding assistants can operate within the framework's architectural boundaries.

Screen adaptation handles phones, foldables, tablets, and landscape/portrait switching through four responsive breakpoints (XS, SM, MD, LG) plus flutter_screenutil. Dark mode, Chinese/English internationalization, and persistent user preferences are built in from the start.

Takeaways
Seven core modules — networking, paginated lists, state management, navigation, screen adaptation, database, and local storage — come pre-wired and documented.
Unit-test coverage reaches 98% line and 95% branch across Core and Demo modules.
The architecture enforces Feature → Repository → DataSource layering; Feature modules never import network or database code directly.
Responsive breakpoints (XS, SM, MD, LG) plus flutter_screenutil handle phones, foldables, tablets, and orientation changes.
Dark mode, Chinese/English internationalization, and persistent user preferences are built in.
A project-level AGENTS.md and specialized Skills files are included to guide AI coding assistants within the framework's boundaries.
Navigation uses type-safe route parameters, result callbacks, and GetMiddleware route guards with Android predictive back support.
Conclusions

Shipping a scaffold with 98% line coverage is unusual for open-source Flutter projects and sets a higher baseline than most commercial app templates.

The explicit AGENTS.md and Skill files signal a shift in how scaffolds are designed: they now target AI tooling as a first-class consumer, not just human developers.

Enforcing that Feature modules never import network or database code directly — only through Repository — is a discipline many Flutter projects claim but few enforce structurally; here it's baked into the module layout.

Concepts & terms
GetX
A Flutter framework combining state management (Rx, Obx), dependency injection (Get.put, Get.find), and route management (GetPage, GetMiddleware) in a single package, often used for its low boilerplate.
TDesign Flutter
Tencent's open-source Flutter UI component library providing pre-built widgets following TDesign's design system, used here as the visual foundation for all demo pages.
AGENTS.md
A project-level markdown file that describes the codebase's architecture, conventions, and boundaries to AI coding assistants so they can generate code that follows the project's rules.
Retrofit (Dart)
A Dart code generator that produces type-safe HTTP client code from annotated abstract classes, working on top of Dio to declare API interfaces rather than writing request logic by hand.
From the discussion

The core tension is around state management: one comment suggests dropping GetX, the author responds by considering a survey and a separate branch, and another voice recommends signals. A longer comment praises the scaffold's completeness and suggests reserving a monitoring/analytics initialization point, which the author addresses by explaining that bootstrap already serves that purpose and a dedicated skill could be written if needed.

GetX should be replaced with another state management solution.
The author is open to surveying state management preferences and creating a separate branch for an alternative framework.
Signals is proposed as a good state management option.
The scaffold should reserve a universal initialization spot for crash monitoring and analytics tools like U-APM.
Bootstrap already handles initialization for monitoring and analytics; a custom skill can provide rapid integration when a project requires it.
Featured comments
高成酱 1 likes

Awesome work. Would be even better if you swapped out Get.

JokerX  · 1 likes

I've been thinking about doing a survey to see what state management solutions people are using. A future version could branch off a separate state management framework for support.

高成酱  → JokerX

signals is pretty good.

向新出发叭 1 likes

This scaffold is very comprehensive. The GetX + TDesign combo works right out of the box, saving a lot of early-stage setup hassle. When I did Flutter projects before, I also dreaded starting from a scaffold — networking layer, routing, local storage, each one had to be wrapped by hand. One small suggestion: if the scaffold aims to be 'universal,' consider reserving an initialization spot for monitoring/analytics. In our earlier project, we didn't integrate crash monitoring at first, and after launch, user-reported crashes could only be guessed at. Later we added U-APM, which connected stack traces with user action paths, and the troubleshooting efficiency became completely different. Of course, this is just personal experience, not necessarily suitable for every project, just for reference. Overall completeness is high, looking forward to future updates!

JokerX  · 1 likes

Actually, bootstrap is meant for initializing all kinds of parameters, whether it's analytics or performance monitoring, for Umeng or other platforms. I didn't include it here; it still depends on project needs. If there's demand, I can write a skill to achieve rapid integration.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗