AI студия Владимира Ломтева
УСЛУГИПРОЕКТЫСТАТЬИБАЗА ЗНАНИЙМаркетплейсПолезные сервисы

Оставьте заявку,
чтобы обсудить проект

Напишите ваш вопрос, не забудьте указать телефон. Мы перезвоним и все расскажем.

Контакты

Москва

Работаем по всей России
и миру (онлайн)

+7 (999) 760-24-41

Ежедневно с 9:00 до 21:00

lamooof@gmail.com

По вопросам сотрудничества

TelegramWhatsApp

Есть предложение?

Напишите нам в мессенджеры

© 2025 AI студия Владимира Ломтева

Политика конфиденциальностиСогласие на обработку ПДн|ИНН 623412173261
    Flutter Apply Architecture Best Practices — Скилл для ИИ-агентов | AI Рассвет

    Flutter Apply Architecture Best Practices

    Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability.

    Скиллы для операций#GitHub#flutter/agent-plugins#skills.sh
    Скачивания
    0
    В избранном
    0
    Комментарии
    0
    Просмотры
    3

    Установить скилл

    Установить скилл

    Добавьте инструмент одной командой или скачайте проверенный архив версии.

    npx skills add flutter/agent-plugins --skill flutter-apply-architecture-best-practices
    Скачать ZIP
    Версия
    1.0.0+864cf8797b19
    Автор
    Владимир Ломтев
    Репозиторий
    flutter/agent-plugins
    GitHub: flutter/agent-plugins

    Добавьте инструмент одной командой или скачайте проверенный архив версии.

    npx skills add flutter/agent-plugins --skill flutter-apply-architecture-best-practices
    Скачать ZIP
    Версия
    1.0.0+864cf8797b19
    Автор
    Владимир Ломтев
    Репозиторий
    flutter/agent-plugins
    GitHub: flutter/agent-plugins

    Как установить

    1. 1Скопируйте команду из блока установки.
    2. 2Запустите её в терминале из каталога проекта.

    Документация

    Architecting Flutter Applications

    Contents

    • Architectural Layers
    • Project Structure
    • Workflow: Implementing a New Feature
    • Examples

    Architectural Layers

    Enforce strict Separation of Concerns by dividing the application into distinct layers. Never mix UI rendering with business logic or data fetching.

    UI Layer (Presentation)

    Implement the MVVM (Model-View-ViewModel) pattern to manage UI state and logic.

    • Views: Write reusable, lean widgets. Restrict logic in Views to UI-specific operations (e.g., animations, layout constraints, simple routing). Pass all required data from the ViewModel.
    • ViewModels: Manage UI state and handle user interactions. Extend ChangeNotifier (or use Listenable) to expose state. Expose immutable state snapshots to the View. Inject Repositories into ViewModels via the constructor.

    Data Layer

    Implement the Repository pattern to isolate data access logic and create a single source of truth.

    • Services: Create stateless classes to wrap external APIs (HTTP clients, local databases, platform plugins). Return raw API models or Result wrappers.
    • Repositories: Consume one or more Services. Transform raw API models into clean Domain Models. Handle caching, offline synchronization, and retry logic. Expose Domain Models to ViewModels.

    Logic Layer (Domain - Optional)

    • Use Cases: Implement this layer only if the application contains complex business logic that clutters the ViewModel, or if logic must be reused across multiple ViewModels. Extract this logic into dedicated Use Case (interactor) classes that sit between ViewModels and Repositories.

    Project Structure

    Organize the codebase using a hybrid approach: group UI components by feature, and group Data/Domain components by type.

    lib/
    ├── data/
    │   ├── models/         # API models
    │   ├── repositories/   # Repository implementations
    │   └── services/       # API clients, local storage wrappers
    ├── domain/
    │   ├── models/         # Clean domain models
    │   └── use_cases/      # Optional business logic classes
    └── ui/
        ├── core/           # Shared widgets, themes, typography
        └── features/
            └── [feature_name]/
                ├── view_models/
                └── views/
    

    Workflow: Implementing a New Feature

    Follow this sequential workflow when adding a new feature to the application. Copy the checklist to track progress.

    Task Progress

    • Step 1: Define Domain Models. Create immutable data classes for the feature using freezed or built_value.
    • Step 2: Implement Services. Create or update Service classes to handle external API communication.
    • Step 3: Implement Repositories. Create the Repository to consume Services and return Domain Models.
    • Step 4: Apply Conditional Logic (Domain Layer).
      • If the feature requires complex data transformation or cross-repository logic: Create a Use Case class.
      • If the feature is a simple CRUD operation: Skip to Step 5.
    • Step 5: Implement the ViewModel. Create the ViewModel extending ChangeNotifier. Inject required Repositories/Use Cases. Expose immutable state and command methods.
    • Step 6: Implement the View. Create the UI widget. Use ListenableBuilder or AnimatedBuilder to listen to ViewModel changes.
    • Step 7: Inject Dependencies. Register the new Service, Repository, and ViewModel in the dependency injection container (e.g., provider or get_it).
    • Step 8: Run Validator. Execute unit tests for the ViewModel and Repository.
      • Feedback Loop: Run tests -> Review failures -> Fix logic -> Re-run until passing.

    Examples

    Data Layer: Service and Repository

    // 1. Service (Raw API interaction)
    class ApiClient {
      Future<UserApiModel> fetchUser(String id) async {
        // HTTP GET implementation...
      }
    }
    
    // 2. Repository (Single source of truth, returns Domain Model)
    class UserRepository {
      UserRepository({required ApiClient apiClient}) : _apiClient = apiClient;
      
      final ApiClient _apiClient;
      User? _cachedUser;
    
      Future<User> getUser(String id) async {
        if (_cachedUser != null) return _cachedUser!;
        
        final apiModel = await _apiClient.fetchUser(id);
        _cachedUser = User(id: apiModel.id, name: apiModel.fullName); // Transform to Domain Model
        return _cachedUser!;
      }
    }
    

    UI Layer: ViewModel and View

    // 3. ViewModel (State management and presentation logic)
    class ProfileViewModel extends ChangeNotifier {
      ProfileViewModel({required UserRepository userRepository}) 
          : _userRepository = userRepository;
    
      final UserRepository _userRepository;
    
      User? _user;
      User? get user => _user;
    
      bool _isLoading = false;
      bool get isLoading => _isLoading;
    
      Future<void> loadProfile(String id) async {
        _isLoading = true;
        notifyListeners();
    
        try {
          _user = await _userRepository.getUser(id);
        } finally {
          _isLoading = false;
          notifyListeners();
        }
      }
    }
    
    // 4. View (Dumb UI component)
    class ProfileView extends StatelessWidget {
      const ProfileView({super.key, required this.viewModel});
    
      final ProfileViewModel viewModel;
    
      @override
      Widget build(BuildContext context) {
        return ListenableBuilder(
          listenable: viewModel,
          builder: (context, _) {
            if (viewModel.isLoading) {
              return const Center(child: CircularProgressIndicator());
            }
            
            final user = viewModel.user;
            if (user == null) {
              return const Center(child: Text('User not found'));
            }
    
            return Column(
              children: [
                Text(user.name),
                ElevatedButton(
                  onPressed: () => viewModel.loadProfile(user.id),
                  child: const Text('Refresh'),
                ),
              ],
            );
          },
        );
      }
    }
    

    Требования и возможности

    Источник пакета
    https://github.com/flutter/agent-plugins/tree/864cf8797b190ddb81e4875db6dd6bab89641f62/skills/flutter-apply-architecture-best-practices

    Файлы версии

    ПутьРазмерSHA256
    SKILL.md635100497869976a903c...

    Частые вопросы

    Как установить Flutter Apply Architecture Best Practices?
    Используйте команду npx skills add flutter/agent-plugins --skill flutter-apply-architecture-best-practices или скачайте ZIP-архив.
    Можно ли скачать Flutter Apply Architecture Best Practices бесплатно?
    Да, опубликованную версию можно скачать из маркетплейса бесплатно.

    Похожие инструменты

    Смотреть все
    Story Long Write长篇网文写作。从大纲到正文,辅助长篇网络小说的创作,包括世界观、人物、情节线管理。触发方式:/story-long-write、/写长篇、「帮我开书」「写大纲」「日更」「续写」「继续写」「修改第X章」「回炉」「重写第X章」。Parallel Deep ResearchONLY use when user explicitly says 'deep research', 'exhaustive', 'comprehensive report', or 'thorough investigation'. Slower and more expensive than parallel-web-search. For normal research/lookup requests, use parallel-web-search instead. Supports multi-turn: pass --previous-interaction-id from a prior research or enrichment to continue with context.LangfuseInteract with Langfuse and access its documentation: tracing, monitoring, creating datasets, running experiments, and evaluating AI applications. Use when needing to (1) query or modify Langfuse data, (2) look up Langfuse documentation, concepts, integration guides, a feature or SDK usage, or (3) do any AI engineering task (AI observability, prompt engineering/management, evaluation and evaluator management, experimentation, dataset management, evaluation-driven CI/CD, feedback collection). Invoke it for tasks in this scope even when Langfuse is not configured or explicitly mentioned.Excel Automation>
    Комментарии

    Войдите, чтобы оставить комментарий.

    Комментариев пока нет.