xiaohongshu
xiaohongshu
flutter-enterprise
Lightweight Flutter enterprise development skill focused on feature-based clean architecture. Use when user asks to: (1) Build enterprise Flutter apps with clean architecture, (2) Implement feature-based modular structure, (3) Set up scalable Flutter project organization, (4) Create maintainable ...
Full skill instructions
Lightweight Flutter development skill for building enterprise applications using feature-based clean architecture patterns.
"Feature-first, testable, maintainable enterprise code" - Focus on:
| Priority | Area | Purpose |
|---|---|---|
| 1 | Feature-Based Structure | Modular, scalable code organization |
| 2 | Clean Architecture | Separation of concerns and testability |
| 3 | Dependency Injection | Loose coupling and maintainability |
| 4 | Enterprise Patterns | Proven enterprise development practices |
| 5 | Code Generation | Boilerplate reduction and consistency |
Execute phases sequentially. Complete each before proceeding.
Output: Feature breakdown with dependency mapping.
Output: Feature architecture diagram and data contracts.
Feature Structure Pattern:
lib/
├── core/
│ ├── constants/
│ ├── errors/
│ ├── network/
│ ├── utils/
│ └── widgets/
├── features/
│ ├── feature_name/
│ │ ├── data/
│ │ │ ├── datasources/
│ │ │ ├── models/
│ │ │ └── repositories/
│ │ ├── domain/
│ │ │ ├── entities/
│ │ │ ├── repositories/
│ │ │ └── usecases/
│ │ └── presentation/
│ │ ├── pages/
│ │ ├── widgets/
│ │ └── providers/
│ └── ...
└── main.dart
Clean Architecture Implementation:
// Domain Layer - Entity
class User {
final String id;
final String name;
final String email;
User({required this.id, required this.name, required this.email});
}
// Domain Layer - Repository (Abstract)
abstract class UserRepository {
Future<List<User>> getUsers();
Future<User> getUserById(String id);
}
// Domain Layer - Use Case
class GetUsersUseCase {
final UserRepository repository;
GetUsersUseCase(this.repository);
Future<List<User>> call() async {
return await repository.getUsers();
}
}
// Data Layer - Repository Implementation
class UserRepositoryImpl implements UserRepository {
final RemoteDataSource remoteDataSource;
UserRepositoryImpl(this.remoteDataSource);
@override
Future<List<User>> getUsers() async {
final userModels = await remoteDataSource.getUsers();
return userModels.map((model) => model.toEntity()).toList();
}
}
| Layer | Responsibility | Key Components |
|---|---|---|
| Presentation | UI and State Management | Pages, Widgets, Providers/Bloc |
| Domain | Business Logic | Entities, Use Cases, Repository Interfaces |
| Data | Data Implementation | Models, Data Sources, Repository Implementations |
// main.dart
void main() {
// Initialize dependencies
final serviceLocator = GetIt.instance;
// Data sources
serviceLocator.registerLazySingleton<RemoteDataSource>(
() => RemoteDataSourceImpl(httpClient: serviceLocator()));
// Repositories
serviceLocator.registerLazySingleton<UserRepository>(
() => UserRepositoryImpl(serviceLocator()));
// Use cases
serviceLocator.registerFactory<GetUsersUseCase>(
() => GetUsersUseCase(serviceLocator()));
runApp(MyApp());
}
This skill now supports state management neutrality with equivalent implementations for all four major approaches:
// Presentation Layer - Provider
class UserProvider extends ChangeNotifier {
final GetUsersUseCase getUsersUseCase;
List<User> _users = [];
bool _isLoading = false;
UserProvider({required this.getUsersUseCase});
List<User> get users => _users;
bool get isLoading => _isLoading;
Future<void> loadUsers() async {
_isLoading = true;
notifyListeners();
try {
_users = await getUsersUseCase();
} catch (e) {
// Handle error
} finally {
_isLoading = false;
notifyListeners();
}
}
}
// Presentation Layer - Bloc
abstract class UserEvent extends Equatable {}
class LoadUsers extends UserEvent {}
abstract class UserState extends Equatable {}
class UserLoading extends UserState {}
class UserLoaded extends UserState {
final List<User> users;
UserLoaded(this.users);
@override
List<Object> get props => [users];
}
class UserBloc extends Bloc<UserEvent, UserState> {
final GetUsersUseCase getUsersUseCase;
UserBloc({required this.getUsersUseCase}) : super(UserInitial()) {
on<LoadUsers>(_onLoadUsers);
}
Future<void> _onLoadUsers(LoadUsers event, Emitter<UserState> emit) async {
emit(UserLoading());
try {
final users = await getUsersUseCase();
emit(UserLoaded(users));
} catch (e) {
// Handle error
}
}
}
// Presentation Layer - Riverpod
class UserNotifier extends StateNotifier<AsyncValue<List<User>>> {
final GetUsersUseCase getUsersUseCase;
UserNotifier({required this.getUsersUseCase}) : super(const AsyncValue.loading());
Future<void> loadUsers() async {
state = const AsyncValue.loading();
try {
final users = await getUsersUseCase();
state = AsyncValue.data(users);
} catch (e, stackTrace) {
state = AsyncValue.error(e, stackTrace);
}
}
}
final userProvider = StateNotifierProvider<UserNotifier, AsyncValue<List<User>>>((ref) {
return UserNotifier(getUsersUseCase: ref.watch(getUsersUseCaseProvider));
});
// Presentation Layer - GetX
class UserController extends GetxController {
final GetUsersUseCase getUsersUseCase;
UserController({required this.getUsersUseCase});
final RxList<User> _users = <User>[].obs;
final RxBool _isLoading = false.obs;
List<User> get users => _users;
bool get isLoading => _isLoading.value;
Future<void> loadUsers() async {
_isLoading.value = true;
try {
final userList = await getUsersUseCase();
_users.assignAll(userList);
} catch (e) {
// Handle error
} finally {
_isLoading.value = false;
}
}
}
// Page Example with GetX
class UserListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetBuilder<UserController>(
init: UserController(getUsersUseCase: Get.find()),
builder: (controller) {
return Scaffold(
appBar: AppBar(title: Text('Users')),
body: Obx(() {
if (controller.isLoading.value) {
return Center(child: CircularProgressIndicator());
}
return ListView.builder(
itemCount: controller.users.length,
itemBuilder: (context, index) {
final user = controller.users[index];
return UserTile(user: user);
},
);
}),
);
},
);
}
}
references/clean-architecture.mdreferences/feature-templates.mdreferences/testing-patterns.mdreferences/code-generation.mdThis Flutter enterprise skill transforms complex enterprise app development into a systematic process that ensures maintainable, scalable, and testable applications using feature-based clean architecture.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience