index_generator 2.1.0 copy "index_generator: ^2.1.0" to clipboard
index_generator: ^2.1.0 copied to clipboard

Automatically generate index / barrel / library files with all the export needed for your library.

Index Generator #

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

Usage #

  1. Activate: dart pub global activate index_generator

  2. Create index_generator.yaml file or add in your pubspec.yaml file:

index_generator:
  filters:
    - black: .*.g.dart$
  # Define the paths of the folders in which to generate the index files
  indexes:
    - path: lib
  1. You can generate index files with one of the following two commands:
  • flutter pub global run index_generator
  • dart pub global run index_generator

Advance Usage #

index_generator:
  # You can define the default name of the index file
  default_name: barrel
  # You can define general filters for all indexes
  filters:
    - black: .*\.g$
  indexes:
    - path: lib
      # You can define specific filters for this index
      filters:
        - white: .*\include.g$
      # You can define specific export folders paths
      folders:
        - lib/src
      # You can define specific export dart packages in index file.
      exports:
        - args/args
    - path: generator
      # You can define the name of the index file
      name: main
      # You can define the name of the library to use within the index
      library: index_generator
  • name: Prioritize ownership in folders, otherwise it will use the one defined in the generator with default_name key. If it is missing, if the folder is lib it will use the package name otherwise the folder name
  • filters: You can define black filters that remove files from the index but white filters will add them back You can use [RegExp] expressions
  • folders: You can define specific export folders paths. The path of the folders is relative to the path of the index.
  • exports: You can define specific export dart packages in index file.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

17
likes
110
pub points
85%
popularity

Publisher

unverified uploader

Automatically generate index / barrel / library files with all the export needed for your library.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

args, checked_yaml, console, json_annotation, path, pubspec, yaml

More

Packages that depend on index_generator