scan abstract method

Future<RuntimeScannerSummary> scan(
  1. String outputFolder,
  2. RuntimeScannerConfiguration loader, {
  3. Directory? source,
})

Defines the contract for a reflection scanner that processes Dart source files, extracts metadata, and optionally persists output.

Used during framework initialization or tooling that requires reflection metadata (e.g., code analyzers, documentation generators, or runtime scanners).

Implementations should handle scanning efficiently and report meaningful summaries including errors, warnings, and informational messages.

Example

final scanner = MyRuntimeScanner();
final loader = RuntimeScanLoader(
  reload: true,
  updatePackages: false,
  updateAssets: true,
  baseFilesToScan: [File('lib/main.dart')],
  packagesToScan: ['package:meta/', 'package:args/'],
);
final summary = await scanner.scan('build/meta', loader);

print(summary.getErrors());

Performs the reflection scan and outputs a RuntimeScannerSummary.

  • outputFolder is the target directory to write scan results.
  • loader is the configuration for the scan.
  • source is the root directory to scan. Defaults to Directory.current.

Returns a Future that resolves to the final RuntimeScannerSummary.

Implementation

Future<RuntimeScannerSummary> scan(String outputFolder, RuntimeScannerConfiguration loader, {Directory? source});