HtmlSanitizer class

Sanitizes HTML content to prevent XSS attacks.

Used internally when injecting content into the DOM.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

escape(String input) String
Escape HTML special characters
escapeAttribute(String input) String
Escape for use inside an HTML attribute value
sanitizeDescription(String input) String
Sanitize a meta description (strip tags, truncate to 160 chars)
sanitizeTitle(String input) String
Sanitize a meta title (strip tags, truncate to 60 chars)
stripTags(String input) String
Strip all HTML tags from a string
truncate(String input, int maxLength) String
Truncate text to a maximum length, adding ellipsis