barrel_file_lints 1.0.3 copy "barrel_file_lints: ^1.0.3" to clipboard
barrel_file_lints: ^1.0.3 copied to clipboard

A Dart 3.10+ analyzer plugin that enforces barrel file import rules for feature-based Flutter architecture. Supports both feature_xxx/ and features/xxx/ naming conventions.

example/example.md

Example Usage #

1. Add to your project #

# pubspec.yaml
dev_dependencies:
  barrel_file_lints: ^1.0.0

2. Configure analysis_options.yaml #

plugins:
  barrel_file_lints:
    diagnostics:
      avoid_internal_feature_imports: true
      avoid_core_importing_features: true
      avoid_self_barrel_import: true

3. Example violations #

Bad: Internal feature import #

// lib/feature_home/ui/home_page.dart

// ❌ This will trigger avoid_internal_feature_imports
import 'package:myapp/feature_auth/data/auth_service.dart';

class HomePage extends StatelessWidget {
  // ...
}

Good: Barrel file import #

// lib/feature_home/ui/home_page.dart

// ✅ Import via barrel file
import 'package:myapp/feature_auth/auth.dart';

class HomePage extends StatelessWidget {
  // ...
}

Bad: Core importing feature #

// lib/core/network/api_client.dart

// ❌ This will trigger avoid_core_importing_features
import 'package:myapp/feature_auth/auth.dart';

class ApiClient {
  // ...
}

4. Run analysis #

dart analyze
# or
flutter analyze
0
likes
150
points
0
downloads

Publisher

verified publisherteklund.dev

Weekly Downloads

A Dart 3.10+ analyzer plugin that enforces barrel file import rules for feature-based Flutter architecture. Supports both feature_xxx/ and features/xxx/ naming conventions.

Repository (GitHub)
View/report issues
Contributing

Topics

#linter #analyzer #flutter #architecture #clean-architecture

Documentation

API reference

License

MIT (license)

Dependencies

analysis_server_plugin, analyzer, analyzer_plugin

More

Packages that depend on barrel_file_lints