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.
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.
- patterns_canvas
Draw patterns like stripes, dots, or checkers on Canvas elements or widgets in Flutter.
64Compare - prompt_dialog
A JavaScript-like prompt dialog widget for Flutter applications.
50Compare - confirm_dialog
An easy-to-use confirm dialog widget for Flutter with a JS-like syntax.
45Compare
Works with
Packages commonly used together with dom_builder: ones it builds on, ones built on it, and its own family.
- htmldom_builder depends on itA Dart implementation of an HTML5 parser for strings and bytes.
- swiss_knifedom_builder depends on itCollection of Dart utility tools for collections, math, date, URI, JSON, events, and resources.
- web_utilsdom_builder depends on itDart extensions for web development, improving JavaScript interop and the web package.
- bones_uiBuilt on dom_builderAn intuitive and user-friendly Web User Interface framework for Dart.
- bones_ui_bootstrapBuilt on dom_builderAdds Bootstrap 5 components and CSS integration to the Bones_UI Dart package.