loadLink function
Include a LinkElement inside the
Future
ex: loadLink('./style.css');
Implementation
Future<LinkElement> loadLink(
String href, {
String? id,
String rel = 'stylesheet',
String type = 'text/css',
}) {
var element = id != null
? document.getElementById(id) as LinkElement?
: document.querySelector("link[href='$href']") as LinkElement?;
if (element == null) {
element = LinkElement()
..type = type
..rel = rel
..href = href;
if (id != null) {
element.id = id;
}
document.head!.append(element);
}
return waitLoad(element);
}