Skip to main content

clean_arch_lint 3.2.0 copy "clean_arch_lint: ^3.2.0" to clipboard
clean_arch_lint: ^3.2.0 copied to clipboard

Analyzer plugin that enforces Clean Architecture layer boundaries in Flutter/Dart projects by checking imports and exports.

example/lib/main.dart

import 'package:clean_arch_lint_example/data/datasources/product_remote_data_source.dart';
import 'package:clean_arch_lint_example/data/repositories/product_repository_impl.dart';
import 'package:clean_arch_lint_example/domain/usecases/get_product_use_case.dart';
import 'package:clean_arch_lint_example/presentation/view_models/product_view_model.dart';
import 'package:clean_arch_lint_example/screens/home/home_screen.dart';
import 'package:flutter/material.dart';

/// Composition root: wires `data` implementations into the domain contracts.
///
/// `lib/main.dart` is outside every layer directory, so it may import all of
/// them. This is the only place that knows [ProductRepositoryImpl].
void main() {
  final repository = ProductRepositoryImpl(ProductRemoteDataSource());
  final viewModel = ProductViewModel(GetProductUseCase(repository));
  runApp(MyApp(viewModel: viewModel));
}

/// Root widget: opens [HomeScreen] with the [ProductViewModel] built in
/// [main].
class MyApp extends StatelessWidget {
  const MyApp({super.key, required this.viewModel});

  final ProductViewModel viewModel;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: HomeScreen(viewModel: viewModel));
  }
}
0
likes
160
points
261
downloads

Documentation

API reference

Publisher

verified publishersaulogatti.com.br

Weekly Downloads

Analyzer plugin that enforces Clean Architecture layer boundaries in Flutter/Dart projects by checking imports and exports.

Repository (GitHub)
View/report issues
Contributing

Topics

#lints #analyzer #architecture #clean-architecture #flutter

License

MIT (license)

Dependencies

analysis_server_plugin, analyzer

More

Packages that depend on clean_arch_lint