HtmlUtils class

HTML utils: wrappers, parsers, splitters etc.

Constructors

HtmlUtils()

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

addSingleQuotes(String data) String
Adds single quotes to the param
buildIframeViewType() String
Builds a unique string to use as windowDisambiguator for when using multiple iframes in the same window.
buildJsFunction(String name, List params) String
Builds a js function using the name and params passed to it.
dataUriToHtml(String data) String
Turns URI-encoded HTML "data:" to pure human-readable HTML
embedClickListenersInPageSource(String pageUrl, String pageSource) String
Embeds click listeners inside the page and calls Dart callback when triggered
embedInHtmlSource({required String source, required String whatToEmbed, required EmbedPosition position}) String
Generic function to embed anything inside HTML source, at the specified position.
embedJsInHtmlSource(String source, Set<String> jsContents, {EmbedPosition position = EmbedPosition.aboveBodyCloseTag}) String
Embeds js in the HTML source at the specified position This is just a helper function for the generic embedInHtmlSource function
embedWebIframeJsConnector(String source, String windowDisambiguator) String
(WEB ONLY): Embeds a js-to-dart connector in the HTML source, allowing us to talk to js on web.
encodeHtmlToURI(String src) String
Encodes HTML to URI
encodeImageAsEmbeddedBase64(String fileName, Uint8List imageBytes) String
Encodes an image (as a list of bytes) to a base64 embedded HTML image
getPathBaseName(String path) String
Retrieves basename from a string path
injectAsChildOf(String htmlTag, String source, String toInject) String
Inject toInject as a child of the specified htmlTag. The htmlTag can be, for example, head or body.
isFullHtmlPage(String src) bool
Checks if the source looks like HTML
preprocessSource(String src, {Set<EmbeddedJsContent> jsContent = const {}, bool forWeb = false, bool encodeHtml = false, String? windowDisambiguator}) String
This is where the magic happens.
unQuoteJsResponseIfNeeded(String rawJsResponse) String
Removes surrounding quotes around a string, if any
wrapHtml(String src, String? iframeId) String
Wraps markup in HTML tags
wrapImageLinkWithImgTag(String imageLink) String
Wraps an image link with "img" tags