hyper_render library
HyperRender - The Universal Content Engine for Flutter
A high-performance rendering engine for HTML, Markdown, and Quill Delta with perfect text selection, advanced CSS support, and CJK typography.
Architecture
This package is a convenience wrapper over hyper_render_core.
For minimal dependencies, use individual packages:
hyper_render_core— Core rendering enginehyper_render_html— HTML parsing with CSS supporthyper_render_markdown— Markdown parsing (GFM)hyper_render_highlight— Syntax highlighting for code blocks
Quick Start
import 'package:hyper_render/hyper_render.dart';
HyperViewer(html: '<h1>Hello World</h1>')
HyperViewer.markdown(markdown: '# Hello World')
HyperViewer.delta(delta: '{"ops":[{"insert":"Hello World\\n"}]}')
Classes
- AdapterResult
- Adapter result with metadata
- AtomicNode
- Atomic/replaced element node (img, video, audio, iframe)
- BlockNode
- Block-level element node (div, p, h1-h6, blockquote, etc.)
- CachedImage
- Cached image data
- CodeBlockWidget
- A widget that displays code with optional syntax highlighting.
- CodeHighlighter
- Interface for code syntax highlighting plugins
- ComputedStyle
- Computed style for a UDT node All CSS properties are resolved to final values here
- ContentParser
- Interface for content parsing plugins
- CssParserInterface
- Interface for CSS parsing plugins
- CssRule
- A CSS rule with selector and declarations
- DefaultCodeHighlighter
- Default code highlighter using flutter_highlight package
- DefaultCssParser
- Default CSS parser using csslib package
- DefaultDeltaParser
- Default Delta parser using DeltaAdapter
- DefaultHtmlParser
-
Default HTML parser using the
htmlpackage - DefaultImageClipboardHandler
- Default implementation that only supports URL copying
- DefaultMarkdownParser
-
Default Markdown parser using the
markdownpackage - DefaultMediaWidget
- Default placeholder for media elements.
- DeltaAdapter
- Quill Delta to UDT adapter
- DocumentAdapter
- Base interface for content adapters.
- DocumentNode
- Document root node
- ErrorBoundaryNode
- Represents a parse or render error wrapped in the UDT for graceful display.
- ErrorBoundaryWidget
- Widget that displays error boundaries in a user-friendly way
- ExtendedContentParser
- Extended parser interface with metadata support
- ExtendedDocumentAdapter
- Extended adapter interface with metadata
- FlexContainerWidget
- Widget that renders a flex container (display: flex)
- FlexItemWidget
- Wrapper for flex items with flex properties (flex-grow, flex-shrink)
- FlexWrapItem
- Attaches a flex item's ComputedStyle to its slot in a FlexWrapLayout.
- FlexWrapLayout
-
A CSS wrapping-flex container (
display: flex; flex-wrap: wrap) on a horizontal main axis. - FlexWrapParentData
- Parent data carrying a wrapping-flex item's CSS box sizing inputs.
- FloatCarryover
- Describes a float element whose visual area extends beyond the bottom of a virtualized section boundary.
- FormulaInfo
- FormulaInfo for media-style handling
- FormulaWidget
- Default formula widget using basic text rendering
- Fragment
- A Fragment represents a unit of content for inline layout
- GridContainerWidget
-
GridContainerWidget — renders a CSS Grid container (
display: grid). - GridItem
- A grid item with its column span for GridContainerWidget.
- HeadingAnchor
- A single entry in the table-of-contents emitted by HyperViewerController.
- HtmlAdapter
- Converts an HTML string into a DocumentNode (Unified Document Tree).
- HtmlHeuristics
- Heuristics for detecting HTML complexity beyond hyper_render's supported subset.
- HtmlSanitizer
- HTML Sanitizer for preventing XSS attacks
- HtmlToSpanConverter
- HtmlToSpanConverter - Core Engine
- HyperAnimatedWidget
- Widget that applies CSS-like animations to its child
- HyperAnimations
- Predefined CSS keyframe animations
- HyperBoxParentData
- Parent data for children of RenderHyperBox
- HyperCubicBezierParams
-
Control points for
cubic-bezier(x1, y1, x2, y2). - HyperDetailsWidget
-
Renders an HTML
<details>/<summary>element as an interactive expand/collapse panel. - HyperErrorWidget
- Beautiful error widget following Material Design 3
- HyperImage
- HyperImage - Image widget with context menu for copy/save/share
- HyperKeyframe
- A single keyframe in an animation
- HyperKeyframes
- A collection of keyframes that define an animation
- HyperMemoryDebug
- Debug-only sink for HyperMemoryMetrics.
- HyperMemoryMetrics
- Snapshot of what a single memory-pressure cycle released.
- HyperNodePlugin
- Abstract base for a HyperRender node plugin.
- HyperPageController
- Controller for HyperViewer in HyperRenderMode.paged mode.
- HyperPluginBuildContext
- Context provided to HyperNodePlugin.buildWidget.
- HyperPluginRegistry
- Registry for HyperNodePlugin instances.
- HyperRenderConfig
- Configuration for the HyperRender engine.
- HyperRenderWidget
- HyperRenderWidget - MultiChildRenderObjectWidget for custom HTML rendering
- HyperSelectionOverlay
- HyperSelectionOverlay - Provides selection UI features like SelectionArea
- HyperSelectionOverlayState
- HyperSelectionState
- Interface for selection operations in the context menu.
- HyperStepsCurve
-
CSS
steps(n, start|end)timing function as a Flutter Curve. - HyperStepsParams
-
Parameters for
steps(count, start|end). - HyperStreamingController
- High-performance controller for AI and LLM token streaming in HyperRender.
- HyperStreamingState
- Immutable snapshot of the streaming state at a specific point in time.
- HyperTable
- Custom HTML table widget.
- HyperTextSelection
- Selection range for text
- HyperTimingParams
-
Parameters for parameterized CSS timing functions
(
cubic-bezier(...)/steps(...)). - HyperTransition
- CSS transition definition
- HyperTransitionWidget
-
Applies CSS
transitionproperty to a child widget. - HyperTypingCaret
- Animated typing caret widget attached to active streaming LLM text in HyperRender.
- HyperViewer
- HyperViewerController
- Controller for HyperViewer that exposes scroll-to-anchor and TOC APIs.
- ImageClipboardHandler
- Interface for image clipboard and sharing operations.
- ImageOperationResult
- Result of an image operation
- InlineNode
- Inline element node (span, a, strong, em, etc.)
- KinsokuProcessor
- Kinsoku processor for CJK line-breaking rules
- LazyImageQueue
- A singleton priority queue for image loading.
- LineBreakNode
- Line break node (br)
- LineInfo
- A line of fragments after layout
- LoadingSkeleton
- Beautiful loading skeleton with shimmer animation
- MarkdownAdapter
- Markdown to UDT adapter
- MediaInfo
- Information about a media element
- ParsedCssRule
- Represents a parsed CSS rule
- ParseResult
- Parse result with metadata
- PlainTextHighlighter
- A no-op highlighter that returns plain text
- PlainTextParser
- A simple plain text parser (no external dependencies)
- RenderFlexWrap
-
Renders a wrapping flex line box: packs items into lines by their base size,
then distributes each line's free space per
flex-grow(or removes overflow perflex-shrink). - RenderHyperBox
- RenderHyperBox - The core custom rendering engine
- RubyNode
- Ruby annotation node (for Japanese Furigana)
- RubySpan
- RubySpan - A WidgetSpan that renders Ruby/Furigana text
- RubyTextWidget
- Widget wrapper for RenderRubyText
- SelectionMenuAction
- Selection menu action
- SimpleInlineStyleParser
- Simple inline style parser (no external dependencies)
- SmartTableWrapper
- Wraps HyperTable with a strategy for handling wide tables.
- StreamSyntaxNormalizer
- Syntax auto-repair utility for streaming Markdown and HTML tokens.
- StyleResolver
- TableCellNode
- Table cell node (td or th)
- TableNode
- Table node
- TableRowNode
- Table row node
- TextNode
- Text content node
- UDTNode
- Base class for all nodes in the Unified Document Tree (UDT)
Enums
- AlignItems
- Align items for CSS align-items property (cross axis alignment)
- CodeTheme
- Available syntax highlighting themes.
- ContentType
- Input type for content parsers
- DisplayType
- Display type for CSS display property
- FlexDirection
- Flex direction for CSS flex-direction property
- FlexWrap
- Flex wrap for CSS flex-wrap property
- FragmentType
- Fragment type for inline layout
- HighlightTheme
- Available syntax highlighting themes for DefaultCodeHighlighter
- HyperAnimationDirection
- CSS animation direction
- HyperAnimationFillMode
- CSS animation fill mode
- HyperAnimationPlayState
- CSS animation play state
- HyperBorderCollapse
-
Border model for CSS
border-collapseproperty. - HyperBoxSizing
-
CSS
box-sizing: whetherwidth/min-width/max-widthsize the content box or also include padding and border. - HyperClear
- Clear behavior for CSS clear property
- HyperContentType
- Content type for HyperViewer
- HyperFloat
- Float behavior for CSS float property
- HyperOverflow
- Overflow behavior for CSS overflow property
- HyperRenderMode
- Rendering mode for HyperViewer.
- HyperStreamingStatus
- Status of an active HyperStreamingController.
- HyperTextAlign
- Text alignment for CSS text-align property
- HyperTimingFunction
- CSS timing function for animations and transitions
- HyperTypingCaretStyle
- Visual style of the streaming HyperTypingCaret.
- HyperVerticalAlign
- Vertical alignment for CSS vertical-align property
- ImageAction
- Image action types for context menu
- ImageLoadState
- Image load state
- InputType
- Input type for the content adapter
- JustifyContent
- Justify content for CSS justify-content property (main axis alignment)
- MediaType
- Type of media element
- NodeType
- Node type in the Unified Document Tree (UDT)
- TableStrategy
- Strategy for tables wider than the available viewport.
Extensions
- AtomicNodeMediaExtension on AtomicNode
- Convenience extension on AtomicNode for media-related helpers.
- HyperAnimationExtension on Widget
- Extension to easily animate widgets
-
HyperCaptureExtension
on GlobalKey<
State< StatefulWidget> > - Extension on GlobalKey to capture a widget as an image.
- HyperRenderWidgetSelectionExtension on HyperRenderWidget
- Extension to easily use HyperSelectionOverlay
- RenderHyperBoxSelection on RenderHyperBox
Functions
-
buildSvgWidget(
UDTNode node) → Widget? -
Returns a Widget for SVG nodes, or
nullfor everything else. -
defaultImageLoader(
String src, void onLoad(Image image), void onError(Object error)) → void - Default image loader using Flutter's NetworkImage
-
detectLanguageFromClass(
String? classAttr) → String? - Detect programming language from a CSS class attribute value.
-
gridItemSpan(
UDTNode node) → int - Detect column span from a UDT node's grid-column style.
Typedefs
- FormulaBuilder = Widget Function(BuildContext context, String formula)
- LaTeX formula rendering support
- HyperImageLoader = void Function(String src, void onLoad(Image image), void onError(Object error))
- Callback for loading images.
- HyperLinkTapCallback = void Function(String url)
- Callback for handling link taps
- HyperWidgetBuilder = Widget? Function(UDTNode node)
- Callback for building custom widgets for embedded content
-
ImageActionCallback
= Future<
bool> Function(ImageAction action, String imageUrl, BuildContext context) - Callback for custom image action handling Return true if the action was handled, false to use default behavior
- ImageBuilder = Widget Function(String src, String? alt, double? width, double? height)
- Callback for handling image loading
- ImageLoadCallback = void Function(String src, ImageLoadState state)
- Callback when image loading state changes
- LinkTapCallback = void Function(String url)
- Callback for handling link taps
- MediaWidgetBuilder = Widget Function(BuildContext context, MediaInfo mediaInfo)
- Callback for building custom media widgets.