HydraLine: real HTML for Flutter Web in the first response
A Flutter Web app ships a canvas and a loader. A crawler receives an empty shell, and every link preview shows a grey rectangle. HydraLine puts semantic HTML into the first HTTP response and hydrates islands of interactivity on top. The app keeps its router and main(), and routes move to it one at a time.
Code: HydraLine, MIT licensed.
What HydraLine ships in the first response
The response carries headings, paragraphs, lists and links, plus canonical, hreflang, Open Graph and Twitter Card data with image dimensions. The sitemap generator splits a map at 50,000 addresses, and the package covers nine JSON-LD types, robots.txt and an audit CLI.
The same document tree streams from a shelf or Dart Frog server and compiles into a static dist/ folder. One model drives SSR and SSG, so a marketing page and an application do not drift apart.
Three levels of interactivity
L0 is static HTML with no JavaScript: details blocks, :target links, lazy images. L1 adds vanilla JavaScript and HTMX islands of about 8–14 KB, enough for tabs, forms and search. L2 loads the Flutter engine only when an island triggers it. Most content pages never reach L2.
An island reserves its exact size through Declarative Shadow DOM, so layout shift stays near zero while the engine loads. Props cross the boundary as JSON in data-state, and one engine instance can host several islands.
No cloaking by contract
A prerender that reads User-Agent serves one page to a bot and another to a person. HydraLine builders cannot see the user agent at all, so both receive byte-identical bodies. An invariant test compares the two responses and fails the build when they differ.
Safe by construction
SafeUrl rejects javascript: and data: at the type level. Escaping depends on context, text or attribute, and sanitizeHtml() strips inline event handlers. Runtime scripts carry SRI integrity and crossorigin. The repository includes an XSS fuzz suite of a million inputs.
Limits
HydraLine is a runtime for SEO and islands, not an application framework. It brings no CMS, design system or router. A new web app that is not on Flutter fits a native web framework better, and a Flutter app without public content pages does not need HydraLine. Adoption costs a builder per route and a decision about which zones deserve the engine.
Get it
Three packages on pub.dev: hydraline for the document core, hydraline_server for shelf and Dart Frog, hydraline_flutter for widgets, static generation and the island runtime. The code is MIT: MADEVAL/HydraLine. 486 unit and widget tests and 26 end-to-end tests in a real Chrome ship with it.
The same approach is explained in Flutter Web SEO with five costs of a canvas-only site.
