HtmlNode class abstract base

A typed HTML tree: text and attributes are escaped, raw markup has to be asked for (raw), and a node returned from a handler is sent as HTML.

import 'package:daravel/html.dart';

HtmlNode userCard(User user) => div(classes: 'card', [
  h2([user.name]),                       // escaped
  p(classes: 'muted', [user.email]),
  if (user.isAdmin) span(classes: 'badge', ['Admin']),
]);

router.get('/users/{id}', (request) async =>
    document(title: 'Profile', [userCard(await find(request))]));

Children are a list of nodes, strings (escaped text), numbers, null (skipped) and nested lists.

Implemented types
Implementers

Constructors

HtmlNode()
const

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
render() → String
toResponse(Request request) → Response
override
toString() → String
A string representation of this object.
override
writeTo(StringSink out) → void

Operators

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