Skip to main content

avoid-barrel-files

added in: 1.7.0
Pro+

Warns when a file is a barrel file.

Barrel files are files that only reexport declarations from other files (ex. all events or models an app has). Barrel files negatively affect analyzer's performance, so it's recommended to avoid them.

Example

❌ Bad:

index.dart
// LINT
export 'package:test/fake.dart';

export 'correct_example.dart';

✅ Good:

other.dart
export 'example.dart';

class SomeClass {}