ParserOptions.fromMap constructor
Creates a ParserOptions instance from a Map.
This factory constructor is used for deserializing parser options from JSON or other map-based formats.
Parameters:
map
: Map containing parser options configuration data
Returns:
- New ParserOptions instance with data from the map
Implementation
factory ParserOptions.fromMap(Map<String, dynamic> map) {
if (map['http'] != null) {
return ParserOptions.http(
options: HttpParserOptions.fromMap(map['http']));
} else if (map['table'] != null) {
return ParserOptions.table(
options: TableParserOptions.fromMap(map['table']));
} else if (map['sibling'] != null) {
return ParserOptions.sibling(
options: SiblingParserOptions.fromMap(map['sibling']));
} else if (map['staticValue'] != null) {
return ParserOptions.staticValue(
options: StaticValueParserOptions.fromMap(map['staticValue']));
} else if (map['stringBetween'] != null) {
return ParserOptions.stringBetween(
options: StringBetweenParserOptions.fromMap(map['stringBetween']));
} else if (map['urlParam'] != null) {
return ParserOptions.urlParam(
options: UrlParamParserOptions.fromMap(map['urlParam']));
} else {
throw ArgumentError('Invalid parser options map: no valid type found');
}
}