Parser constructor

Parser({
  1. required String id,
  2. required List<String> parents,
  3. required ParserType type,
  4. List<String> selectors = const [],
  5. bool isPrivate = false,
  6. bool multiple = false,
  7. ParserOptions? parserOptions,
  8. TransformationOptions? transformationOptions,
  9. CleanerFunction? cleaner,
  10. String? cleanerName,
})

Creates a new Parser instance.

Parameters:

  • id: Unique identifier for the parser's output
  • parents: List of parent parser IDs this parser depends on
  • type: Type of parser (element, text, image, etc.)
  • selectors: CSS selectors to locate elements (default: empty list)
  • isPrivate: Whether output should be private (default: false)
  • multiple: Whether to extract multiple results (default: false)
  • parserOptions: Parser-specific configuration options (optional)
  • transformationOptions: Data transformation configuration (optional)
  • cleaner: Custom cleaning function (optional)
  • cleanerName: Name of registered cleaner function (optional)

Implementation

Parser({
  required this.id,
  required this.parents,
  required this.type,
  this.selectors = const [],
  this.isPrivate = false,
  this.multiple = false,
  this.parserOptions,
  this.transformationOptions,
  this.cleaner,
  this.cleanerName,
}) {
  /// Resolve cleaner function from registry if cleanerName is provided
  if (cleanerName != null) {
    cleaner = CleanerRegistry.resolve(cleanerName);
  }
}