UrlCleaner class

Configuration for cleaning and normalizing URLs before making HTTP requests.

This class defines rules for modifying URLs to remove unwanted parameters, keep only specific parameters, or add additional parameters. This is useful for:

  • Removing tracking parameters (utm_source, utm_campaign, etc.)
  • Normalizing URLs for consistent scraping

The cleaning process follows this order:

  1. Remove blacklisted parameters
  2. Keep only whitelisted parameters (if specified)
  3. Add additional parameters

Constructors

UrlCleaner.new({List<String>? whitelistParams, List<String>? blacklistParams, Map<String, String>? appendParams})
Creates a new UrlCleaner instance.
UrlCleaner.fromJson(String json)
Creates a UrlCleaner instance from a JSON string.
factory
UrlCleaner.fromMap(Map<String, dynamic> map)
Creates a UrlCleaner instance from a Map.
factory

Properties

appendParams Map<String, String>?
Additional parameters to append to the cleaned URL.
getter/setter pair
blacklistParams List<String>?
List of query parameters to remove from the URL.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
whitelistParams List<String>?
List of query parameters to keep in the cleaned URL.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
Converts the UrlCleaner instance to a JSON string.
toMap() Map<String, dynamic>
Converts the UrlCleaner instance to a Map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited