Skip to content
pubscout

index_generator

4.1.2, released a year ago by an unverified publisher

Automatically generate index / barrel / library files with all exports needed.

$ flutter pub add index_generator
Source repository

What it does

Scans directories and automatically generates index, barrel, or library files with the necessary export statements. It can be run globally via the command line or integrated via build_runner.

AI-written summary of version 4.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to automate the creation of barrel files (index.dart) for your libraries.
  • You need to include/exclude specific files or packages using glob expressions.

Skip it when

  • You prefer manually maintaining all export statements in your project.

Strengths

  • Supports custom include/exclude filters via glob expressions.
  • Can be run via CLI or integrated with build_runner.
  • Allows custom output paths, disclaimers, and package-style exports.

Weaknesses

  • Not documented beyond configuration options and basic usage.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
11

Activate globally or add to dev_dependencies with build_runner, and configure via index_generator.yaml or pubspec.yaml.

index_generator:
  exclude:
    - "**.g.dart"
  libraries:
    - directory_path: lib

Alternatives

Packages that do the same job and could replace index_generator.

  • json_serializable

    Automatically generate code for converting Dart classes to and from JSON.

  • protobuf

    Provides runtime support for Dart protocol buffer messages generated by protoc_plugin.

  • protoc_plugin

    Generates Dart source files from Protocol Buffer (.proto) definitions using the protoc compiler.

  • mason

    Dart template generator for quick file creation

Works with

Packages commonly used together with index_generator: ones it builds on, ones built on it, and its own family.