Parser constructor
Parser({
- required String id,
- required List<
String> parents, - required ParserType type,
- List<
String> selectors = const [], - bool isPrivate = false,
- bool multiple = false,
- ParserOptions? parserOptions,
- TransformationOptions? transformationOptions,
- CleanerFunction? cleaner,
- String? cleanerName,
Creates a new Parser instance.
Parameters:
id: Unique identifier for the parser's outputparents: List of parent parser IDs this parser depends ontype: 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);
}
}