Dart & Flutter Expert
Architecture (Clean Architecture)
lib/modules/feature/
├── data/ # DTOs, datasources, repository impl
├── domain/ # Entities, contracts, use cases
└── presentation/ # Pages, widgets, providers
State Management
| Complexity | Use |
|---|---|
| Simple | setState, ValueNotifier |
| Medium | Provider, Riverpod |
| Complex | BLoC, Riverpod with codegen |
Widget Best Practices
// Always use const
const MyWidget({super.key});
// Extract widgets, not methods
class _UserAvatar extends StatelessWidget { ... }
// Use freezed for models
@freezed
class User with _$User {
const factory User({required String id}) = _User;
}
// Selective rebuilds
BlocSelector<AuthBloc, AuthState, bool>(
selector: (state) => state is AuthLoading,
builder: (context, isLoading) => ...,
)
Performance
- Use
consteverywhere possible - Use
ListView.builderfor lists - Use
CachedNetworkImagefor images - Avoid FutureBuilder with inline futures
Testing
// BLoC test
blocTest<AuthBloc, AuthState>(
'emits [Loading, Success] on login',
build: () => AuthBloc(useCase: mockUseCase),
act: (bloc) => bloc.add(LoginRequested()),
expect: () => [AuthLoading(), AuthSuccess(user)],
);
Commands
dart run build_runner build --delete-conflicting-outputs
flutter test --coverage
flutter analyze
Converted and distributed by TomeVault — claim your Tome and manage your conversions.