Skip to content
pubscout

dom_builder

3.3.3, released 2 weeks ago by an unverified publisher

Generate and manipulate virtual or real DOM elements, DSX, and HTML declarations.

WASM-ready
$ flutter pub add dom_builder
Source repository

What it does

Allows developers to generate and manipulate DOM elements, HTML declarations, and DSX (similar to JSX) across Web and Native platforms. Supports element querying, building, accessibility attributes, and mixing virtual elements with real package:web elements.

AI-written summary of version 3.3.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to build or manipulate DOM trees in Dart for web or native environments.
  • You want to use HTML-like declarative syntax (DSX) in Dart code.
  • You need to construct HTML tables, Bootstrap cards, and custom components dynamically.

Skip it when

  • You are building standard Flutter UI widgets where Flutter's widget tree is sufficient.
  • You do not need DOM manipulation or HTML rendering capabilities.

Strengths

  • Works across both Web and Native platforms.
  • Supports DSX (Dart Syntax Extension) similar to JSX.
  • Built-in accessibility attribute support (ARIA, roles, tabIndex).

Weaknesses

  • Limited to DOM manipulation and HTML-related workflows, making it unnecessary for standard Flutter UI applications.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5
import 'package:dom_builder/dom_builder.dart';

void main() {
  var div = $divHTML('<div class="container"><span>Builder</span></div>')
      .insertAt( 0, $span( id: 's1', content: 'The ' ) )
      .insertAfter( '#s1' , $span( id: 's2', content: 'DOM ', style: 'font-weight: bold' ) );
  print( div.buildHTML( withIdent: true ) );
}

Alternatives

Packages that do the same job and could replace dom_builder.

Works with

Packages commonly used together with dom_builder: ones it builds on, ones built on it, and its own family.