v4.1.2
index_generator
自動為您的程式庫產生索引/條帶/程式庫檔案,包含所有需要的匯出。
33喜歡 1.2萬近 30 天下載160Pub 分數
AndroidiOSmacOSWindowsLinux
BreX900/index_generator open-source repository details.
^4.1.0^2.3.1^1.8.1^3.1.1^2.0.1^4.9.0^2.1.0^1.16.0^3.0.0^2.0.0^4.0.0^5.0.0^1.21.6^2.10.1^6.11.1以下為英文專案原文快照,最新內容請造訪 GitHub。
Automatically generate index / barrel files with all the exports needed for your library.
There will be no more breaking changes
Activate: dart/flutter pub global activate index_generator
Create index_generator.yaml file or add in your pubspec.yaml file:
index_generator:
exclude:
- "**.g.dart"
# Define the paths of the folders in which to generate the index files
libraries:
- directory_path: lib
<dart|flutter> pub global run index_generatorindex_generator:
# You can define the default name of the index file
default_file_name: barrel
# You can define general filters for all indexes
exclude:
- "**.g.dart"
- "{_,**/_}*.dart"
libraries:
- directory_path: lib
# You can define specific filters for this index
include:
# You can define specific export folders paths
- "src/**"
# You can define specific export dart packages in index file.
exports:
- package: package:args/args.dart
show:
- ArgResults
hide:
- ArgParser
- directory_path: generator
# You can define the name of the index file
file_name: main
# Disable/Enable the generated code disclaimer
disclaimer: false
# Include/Exclude the library keyword in generated file
include_library: true
# Comments added on the generated file, like copyright
comments: |
Copyright (c) 2020 BreX900
# Documentation added on the generated file above the library name
# Note: docs are only included when include_library is true
docs: |
Automatically generate index / barrel / library files
with all the export needed for your library.
# You can define the name of the library to use within the index
name: index_generator
# Use package-style exports for internal files (e.g., 'package:app/main.dart' instead of 'main.dart')
use_package_exports: true
# Custom output path for the generated index file (optional)
# If not specified, the file will be created in the directory_path
output_path: lib/generated
default_file_name key.
If it is missing, if the folder is lib it will use the package name otherwise the folder namelibrary keywordlibrary keyword in the generated file. Defaults to trueinclude_library is truepackage to export a dart file package or dart core library.'package:app/main.dart' instead of 'main.dart').
This is useful for libraries that want to ensure consistent import paths. Defaults to false.--help command output:
-s, --settings=<Define a yaml file path.> If not present use the "index_generator.yaml" file if it exists otherwise use the "pubspec.yaml" file.
-v, --[no-]verbose Print verbose logs
-h, --help
index_generator can be run via build_runner. To do so, add the following dependancies:
dev_dependencies:
build_runner: ^2.10.0
index_generator: ^4.1.0
and enable it in build.yaml file
targets:
$default:
builders:
index_generator:
enabled: true
To generate use <dart|flutter> pub run build_runner <build|watch>
Please file feature requests and bugs at the issue tracker.
hashCode, ==, toString, copyWith and change methods with low code.