|
| 1 | +--- |
| 2 | +name: flutter-architecture-expert |
| 3 | +description: Architecture guidance for Flutter apps using the flutter_it construction set (get_it, watch_it, command_it, listen_it). Covers Pragmatic Flutter Architecture (PFA) with Services/Managers/Views, feature-based project structure, manager pattern, proxy pattern with optimistic updates and override fields, DataRepository with reference counting, scoped services, widget granularity, testing, and best practices. Use when designing app architecture, structuring Flutter projects, implementing managers or proxies, or planning feature organization. |
| 4 | +metadata: |
| 5 | + author: flutter-it |
| 6 | + version: "1.0" |
| 7 | +--- |
| 8 | + |
1 | 9 | # flutter_it Architecture Expert - App Structure & Patterns |
2 | 10 |
|
3 | 11 | **What**: Architecture guidance for Flutter apps using the flutter_it construction set (get_it + watch_it + command_it + listen_it). |
@@ -338,15 +346,15 @@ abstract class DataRepository<T, TProxy extends DataProxy<T>, TId> { |
338 | 346 |
|
339 | 347 | **Reference counting flow**: |
340 | 348 | ``` |
341 | | -Feed creates ChatProxy(id=1) → refCount=1 |
342 | | -Page opens same proxy → refCount=2 |
343 | | -Page closes, releases → refCount=1 (proxy stays for feed) |
344 | | -Feed refreshes, releases → refCount=0 (proxy disposed) |
| 349 | +Feed creates ChatProxy(id=1) -> refCount=1 |
| 350 | +Page opens same proxy -> refCount=2 |
| 351 | +Page closes, releases -> refCount=1 (proxy stays for feed) |
| 352 | +Feed refreshes, releases -> refCount=0 (proxy disposed) |
345 | 353 | ``` |
346 | 354 |
|
347 | 355 | ## Feed/DataSource Pattern |
348 | 356 |
|
349 | | -For paginated lists and infinite scroll, see the dedicated `/skills/feed-datasource-expert.md` skill. Key concepts: `FeedDataSource<TItem>` (non-paged) and `PagedFeedDataSource<TItem>` (cursor-based pagination) with separate Commands for initial load vs pagination, auto-pagination at `items.length - 3`, and proxy reference counting on refresh. |
| 357 | +For paginated lists and infinite scroll, see the dedicated `feed-datasource-expert` skill. Key concepts: `FeedDataSource<TItem>` (non-paged) and `PagedFeedDataSource<TItem>` (cursor-based pagination) with separate Commands for initial load vs pagination, auto-pagination at `items.length - 3`, and proxy reference counting on refresh. |
350 | 358 |
|
351 | 359 | ## Widget Granularity |
352 | 360 |
|
@@ -379,7 +387,7 @@ class _Counter extends WatchingWidget { |
379 | 387 | // Result: user change only rebuilds _Header, count change only rebuilds _Counter |
380 | 388 | ``` |
381 | 389 |
|
382 | | -**Note**: When working with Listenable, ValueListenable, ChangeNotifier, or ValueNotifier, check the listen_it skill for `listen()` and reactive operators (map, debounce, where, etc.). |
| 390 | +**Note**: When working with Listenable, ValueListenable, ChangeNotifier, or ValueNotifier, check the listen-it-expert skill for `listen()` and reactive operators (map, debounce, where, etc.). |
383 | 391 |
|
384 | 392 | ## Testing |
385 | 393 |
|
|
0 commit comments