Plugin for JetBrains IDEs (IntelliJ IDEA, WebStorm, Android Studio) that generates barrel files for Dart and Flutter projects.
In Dart (and other languages), a barrel file is a file that re-exports several other files from a directory, allowing you to import multiple files through a single import. This helps organize and simplify your code.
- Generate barrel file for the selected folder
- Generate barrel files recursively for the folder and its subfolders
- Generate barrel file including all files from subfolders
- Open your JetBrains IDE (IntelliJ IDEA, WebStorm, Android Studio)
- Go to
Settings/Preferences > Plugins > Marketplace - Search for "Dart Barrel Generator"
- Click "Install"
- Restart the IDE when prompted
- Right-click on a folder in the Project Explorer
- Select "Dart Barrel Generator" from the context menu
- Choose one of the options:
- Generate Barrel for This Folder: Creates a barrel file only for the selected folder
- Generate Barrel Recursive: Creates barrel files for the selected folder and all its subfolders
- Generate Barrel with Subfolders: Creates a barrel file including all files from subfolders
Access the plugin settings in Settings/Preferences > Tools > Dart Barrel Generator.
- Default barrel file name: Sets a custom name for barrel files (by default, uses the folder name)
- Prompt for file name: Asks for the barrel file name before creating it
- Skip empty folders: Does not create barrel files for folders without Dart files
- Exclude .freezed.dart files: Does not include .freezed.dart files in barrel files
- Exclude .g.dart files (generated): Does not include .g.dart files in barrel files
- Add folder name at the beginning: Adds the folder name at the beginning of exports
- Add folder name at the end: Adds the folder name at the end of exports
- Use package: format for exports in the lib folder: Uses the package: format for exports in the lib folder
This plugin was developed in Kotlin for JetBrains IDEs, based on the functionality of the VSCode plugin "Dart Barrel File Generator".
- IntelliJ IDEA (Community or Ultimate)
- Plugin DevKit installed
- JDK 17 or higher
- Gradle
./gradlew build./gradlew runIdeBased on the VSCode plugin Dart Barrel File Generator by Miquel de Domingo i Giralt.