RuntimeScannerConfiguration constructor

const RuntimeScannerConfiguration({
  1. bool reload = false,
  2. bool updatePackages = false,
  3. bool updateAssets = false,
  4. bool skipTests = true,
  5. List<String> packagesToScan = const [],
  6. List<String> packagesToExclude = const [],
  7. List<File> filesToScan = const [],
  8. List<File> filesToExclude = const [],
  9. List<Type> scanClasses = const [],
  10. List<Type> excludeClasses = const [],
  11. List<File> additions = const [],
  12. List<File> removals = const [],
  13. bool enableTreeShaking = false,
  14. bool writeDeclarationsToFiles = false,
  15. String outputPath = 'build/generated',
})

Configuration controller for reflection scanning operations in JetLeaf.

This class provides fine-grained control over how reflection metadata is collected, allowing customization of scanning behavior through various flags and inclusion/exclusion lists. It's used to configure reflection operations in both development and production.

{@template scan_loader_usage}

Typical Use Cases

  • Incremental scanning during development
  • Full reloads for code generation
  • Selective scanning of specific packages/files
  • Test environment configuration

Example Configuration

final loader = RuntimeScanLoader(
  reload: true,  // Force full reload
  skipTests: true,  // Exclude test files
  packagesToScan: ['my_package', 'r:package:my_other.*'],
  filesToScan: [
    File('lib/main.dart'),
    File('lib/src/core.dart'),
  ],
  excludeClasses: [GeneratedClass],  // Skip generated code
);

Creates a scan configuration with customizable behavior.

All parameters are optional with sensible defaults for typical use cases.

// Minimal configuration
final minimalLoader = RuntimeScanLoader();

// Full configuration
final fullLoader = RuntimeScanLoader(
  reload: true,
  updatePackages: true,
  skipTests: Platform.environment['CI'] != 'true',
  packagesToExclude: ['test_utils'],
  filesToScan: [File('lib/main.dart')],
);

Implementation

const RuntimeScannerConfiguration({
  this.reload = false,
  this.updatePackages = false,
  this.updateAssets = false,
  this.skipTests = true,
  this.packagesToScan = const [],
  this.packagesToExclude = const [],
  this.filesToScan = const [],
  this.filesToExclude = const [],
  this.scanClasses = const [],
  this.excludeClasses = const [],
  this.additions = const [],
  this.removals = const [],
  this.enableTreeShaking = false,
  this.writeDeclarationsToFiles = false,
  this.outputPath = 'build/generated',
});