Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added
- Documentation for recommended state/controller registration pattern for consumer apps (`doc/architecture/controllers.md`, `doc/guides/state-management.md`)
- State registration guidance in scaffolded `app_service_provider.stub`

## [0.0.1-alpha.8] - 2026-03-31

### 🐛 Bug Fixes
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ App launch → MagicStarterServiceProvider.boot()
| [Manager](https://magic.fluttersdk.com/packages/starter/architecture/manager) | Singleton manager and customization hooks |
| [Service Provider](https://magic.fluttersdk.com/packages/starter/architecture/service-provider) | Bootstrap lifecycle, Gate abilities, IoC bindings |
| [View Registry](https://magic.fluttersdk.com/packages/starter/architecture/view-registry) | String-keyed builders and host app overrides |
| [Controllers & State Registration](https://magic.fluttersdk.com/packages/starter/architecture/controllers) | Recommended state/controller registration pattern for consumer apps |
| [State Management Guide](https://magic.fluttersdk.com/packages/starter/guides/state-management) | State management best practices and patterns |

---

Expand Down
20 changes: 20 additions & 0 deletions assets/stubs/install/app_service_provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,25 @@ class AppServiceProvider extends ServiceProvider {
{{ teams_block }}
{{ social_login_block }}
{{ notifications_block }}

// -------------------------------------------------------------------
// State Registration (optional — for eager initialization)
// -------------------------------------------------------------------
// Most state classes should use the lazy singleton pattern with a
// static accessor instead of registering here:
//
// class ProjectState extends MagicController
// with MagicStateMixin<List<Project>> {
// static ProjectState get instance =>
// Magic.findOrPut(ProjectState.new);
// }
//
// Only register here if the state needs to be ready before any view
// renders (e.g., WebSocket connection, auth-dependent init):
//
// Magic.findOrPut(DashboardState.new);
//
// See the Magic Starter package documentation/repository for the
// controller architecture guide.
}
}
Loading