पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv4.1.2

index_generator

अपनी लाइब्रेरी के लिए सभी आवश्यक निर्यात के साथ स्वचालित रूप से इंडेक्स / बैरल / लाइब्रेरी फ़ाइलें बनाएं।

AndroidiOSmacOSWindowsLinux
30-दिन डाउनलोड
26.4 हज़ार
लाइक
33
Pub अंक
140

पैकेज इंस्टॉल करें

flutter pub add index_generator

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

index_generator एक Flutter/Dart पैकेज है जो सूचकांक (बैरल) फ़ाइलों के निर्माण को स्वचालित करता है, सभी संबंधित Dart फ़ाइलों के लिए आउटपुट उत्पन्न करके लाइब्रेरी संगठन को सरल बनाता है। यह बड़े कोडबेस में बहुत सारे मॉड्यूल या पैकेज के साथ काम करते समय हस्तचालित प्रयास को कम करता है और त्रुटियों को कम करता है। टूल कमांड लाइन के माध्यम से विकास कार्यप्रवाह में बिना किसी दिक्कत के एकीकृत होता है, जिससे डायरेक्टरी के भीतर आउटपुट घोषनाओं को एक समान और अद्यतन बनाए रखा जाता है। शुद्ध, बनाए रखने योग्य कोड संरचना को प्राथमिकता देने वाले डेवलपर्स के लिए आदर्श है।

उपयोग

  • निर्यात फ़ाइल उत्पादन को स्वचालित करना
  • साफ लाइब्रेरी संरचना बनाए रखना
  • पैकेज विकास को सुगम बनाना
  • हाथ से निर्यात त्रुटियों को कम करना
  • मॉड्यूलर ऐप आर्किटेक्चर का समर्थन करना

मुख्य विशेषताएँ

  • स्वचालित बैरल फ़ाइल उत्पन्न करें
  • कमांड-लाइन एंटीग्रेशन
  • कई प्लेटफॉर्म का समर्थन करता है
  • सुनिश्चित करें कि निर्यात समान हों
  • आवश्यक विन्यास न्यूनतम

इनके लिए उपयुक्त

  • बड़े पैमाने वाले Flutter प्रोजेक्ट
  • लाइब्रेरी लेखक
  • मॉड्यूलर कोडबेस का उपयोग करने वाली टीमें
  • स्वचालन की खोज कर रहे विकासकर्ता
  • अक्सर फ़ाइल पुनर्गठन वाले प्रोजेक्ट्स

विचार योग्य बातें

  • pubspec.yaml में सेटअप की आवश्यकता है
  • हस्त संपादन के साथ टकराव हो सकता है
  • नियंत्रित निर्देशिका संरचनाओं में सबसे अच्छा उपयोग किया जाता है
  • सरल ऐप्स के लिए उपयुक्त नहीं
  • सही फ़ोल्डर संगठन पर निर्भर करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Index Generator

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

Stable release

There will be no more breaking changes

Usage

  1. Activate: dart/flutter pub global activate index_generator

  2. 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
  1. You can generate index files with: <dart|flutter> pub global run index_generator

Advance Usage

See more examples

index_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
  • directory_path: Path in which to create the index file. All filters will get the relative path from this directory
  • output_path: Custom output path for the generated index file. If not specified, the file will be created in the directory_path
  • file_name: Prioritize ownership in folders, otherwise it will use the one defined in the generator with default_file_name key. If it is missing, if the folder is lib it will use the package name otherwise the folder name
  • name: The name of the library used in the index dart file by the library keyword
  • include_library: Include or exclude the library keyword in the generated file. Defaults to true
  • docs: Documentation comments added above the library declaration. Only included when include_library is true
  • include | exclude: You can define filters that exclude or include files to be included in the index. The filters are passed paths relative to the index file. You can use Glob expressions.
  • exports: You can define specific export dart packages in index file. You can use package to export a dart file package or dart core library.
  • use_package_exports: When enabled, generates package-style exports for internal files (e.g., 'package:app/main.dart' instead of 'main.dart'). This is useful for libraries that want to ensure consistent import paths. Defaults to false.

Command

--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

Build runner

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>

Features and bugs

Please file feature requests and bugs at the issue tracker.

Extra

  • mek_assets: Automatically generate dart classes / flutter pubspec entries for your assets files.
  • mek_data_class: Generate hashCode, ==, toString, copyWith and change methods with low code.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 11 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट