dvWithPreloads function

String dvWithPreloads(
  1. String page,
  2. String links
)

page with links at the end of its head. Unchanged when there is nothing to add or no head to add it to.

Implementation

String dvWithPreloads(String page, String links) {
  if (links.isEmpty) return page;
  final int close = page.indexOf('</head>');
  if (close < 0) return page;
  return '${page.substring(0, close)}$links${page.substring(close)}';
}