dart_node_react library

External Documentation

React bindings for Dart

Classes

Children

Utilities for dealing with the children prop.

Context<T>

A Context object created by createContext.

DomNode

Wrapper around a DOM node providing query and interaction methods.

El

Wrapper class enabling operator-based element composition.

ReducerHook<TState, TAction>

The return value of useReducer.

Ref<T>

When this is provided as the ref prop, a reference to the rendered component will be available via current.

RenderResult

Result of rendering a React element for testing.

ScreenQuery

Query methods for finding elements in the rendered output.

Simulate

Event simulation interface.

StateHook<T>

The return value of useState.

StateHookJS

State hook for JS interop types (JSString, JSObject, etc).

StateHookJSArray<T extends JSAny>

State hook for lists of JS objects.

TestRenderResult

Result of rendering a React component for testing.

Extension Types

AElement

Anchor element type

ButtonElement

Button element type

DivElement

Div element type

Document

Document global object for DOM access.

FooterElement

Footer element type

H1Element

H1 heading element type

H2Element

H2 heading element type

HeaderElement

Header element type

ImgElement

Image element type

InputElement

Input element type

JsContext

A JavaScript context object returned by React.createContext().

JsRef

A JavaScript ref object returned by React.createRef() or useRef().

LiElement

List item element type

MainElement

Main element type

PElement

Paragraph element type

React

React global object providing access to React's core APIs.

ReactDOM

ReactDOM global object providing DOM-specific methods.

ReactElement

Base type for all React elements - provides type safety over raw JSObject.

ReactPortal

A virtual DOM node representing a React Portal.

ReactRoot

A React root for rendering React elements into the DOM.

SpanElement

Span element type

SyntheticAnimationEvent

A SyntheticEvent wrapper backed by an AnimationEvent.

SyntheticChangeEvent

A SyntheticEvent wrapper for change events.

SyntheticClipboardEvent

A SyntheticEvent wrapper backed by a ClipboardEvent.

SyntheticCompositionEvent

A SyntheticEvent wrapper backed by a CompositionEvent.

SyntheticDragEvent

A SyntheticEvent wrapper backed by a DragEvent.

SyntheticEvent

A cross-browser wrapper around the browser's native event.

SyntheticFocusEvent

A SyntheticEvent wrapper backed by a FocusEvent.

SyntheticFormEvent

A SyntheticEvent wrapper that represents a form event.

SyntheticInputEvent

A SyntheticEvent wrapper for input events.

SyntheticKeyboardEvent

A SyntheticEvent wrapper backed by a KeyboardEvent.

SyntheticMouseEvent

A SyntheticEvent wrapper backed by a MouseEvent.

SyntheticPointerEvent

A SyntheticEvent wrapper backed by a PointerEvent.

SyntheticTouchEvent

A SyntheticEvent wrapper backed by a TouchEvent.

SyntheticTransitionEvent

A SyntheticEvent wrapper backed by a TransitionEvent.

SyntheticUIEvent

A SyntheticEvent wrapper backed by a UIEvent.

SyntheticWheelEvent

A SyntheticEvent wrapper backed by a WheelEvent.

UlElement

Unordered list element type

Properties

$br ReactElement

Creates a <br> element (self-closing, no children).
no setter

$code El

Creates a <code> element wrapper for JSX-style composition.
no setter

$em El

Creates an <em> element wrapper for JSX-style composition.
no setter

$fragment El

Creates a Fragment wrapper for JSX-style composition.
no setter

$h1 El

Creates an <h1> element wrapper for JSX-style composition.
no setter

$h2 El

Creates an <h2> element wrapper for JSX-style composition.
no setter

$h3 El

Creates an <h3> element wrapper for JSX-style composition.
no setter

$h4 El

Creates an <h4> element wrapper for JSX-style composition.
no setter

$h5 El

Creates an <h5> element wrapper for JSX-style composition.
no setter

$h6 El

Creates an <h6> element wrapper for JSX-style composition.
no setter

$strong El

Creates a <strong> element wrapper for JSX-style composition.
no setter

Fragment JSAny

The Fragment type for grouping children without adding extra DOM nodes.
no setter

StrictMode JSAny

The StrictMode type for highlighting potential problems in an application.
no setter

Suspense JSAny

The Suspense type for displaying a fallback while children are loading.
no setter

Functions

$a({required String href, String? key, String? className, String? id, String? target, String? rel, Map<String, dynamic>? style, Map<String, dynamic>? spread, void onClick()?}) El

Creates an <a> element wrapper for JSX-style composition.

$article({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <article> element wrapper for JSX-style composition.

$aside({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <aside> element wrapper for JSX-style composition.

$audio({String? src, String? className, String? id, bool? controls, bool? autoplay, bool? loop, bool? muted, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <audio> element wrapper for JSX-style composition.

$blockquote({String? className, String? id, String? cite, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <blockquote> element wrapper for JSX-style composition.

$button({String? key, String? className, String? id, String? type, bool? disabled, Map<String, dynamic>? style, Map<String, dynamic>? spread, void onClick()?}) El

Creates a <button> element wrapper for JSX-style composition.

$div({String? key, String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread, void onClick()?, void onMouseEnter(SyntheticMouseEvent)?, void onMouseLeave(SyntheticMouseEvent)?}) El

Creates a <div> element wrapper for JSX-style composition.

$el(String tagName, {String? key, String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates any HTML element by tag name for JSX-style composition.

$footer({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <footer> element wrapper for JSX-style composition.

$form({String? className, String? id, String? action, String? method, Map<String, dynamic>? style, Map<String, dynamic>? props, void onSubmit(SyntheticEvent)?}) El

Creates a <form> element wrapper for JSX-style composition.

$h1Props({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <h1> element with props.

$h2Props({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <h2> element with props.

$h3Props({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <h3> element with props.

$header({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <header> element wrapper for JSX-style composition.

$hr({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) ReactElement

Creates an <hr> element (self-closing, no children).

$iframe({required String src, String? className, String? id, int? width, int? height, String? title, String? sandbox, String? allow, Map<String, dynamic>? style, Map<String, dynamic>? props}) ReactElement

Creates an <iframe> element (self-closing unless children needed).

$img({required String src, String? alt, String? className, String? id, int? width, int? height, Map<String, dynamic>? style, Map<String, dynamic>? props, void onClick()?}) ImgElement

Creates an <img> element (self-closing, no children).

$input({String? key, String? className, String? id, String? type, String? name, String? value, String? placeholder, bool? disabled, bool? readOnly, bool? required, Map<String, dynamic>? style, Map<String, dynamic>? spread, void onChange(SyntheticEvent)?, void onInput(SyntheticEvent)?, void onFocus(SyntheticFocusEvent)?, void onBlur(SyntheticFocusEvent)?, void onKeyDown(SyntheticKeyboardEvent)?, void onKeyUp(SyntheticKeyboardEvent)?}) El

Creates an <input> element wrapper for JSX-style composition.

$label({String? className, String? id, String? htmlFor, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <label> element wrapper for JSX-style composition.

$li({String? key, String? className, String? id, int? value, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <li> element wrapper for JSX-style composition.

$main({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <main> element wrapper for JSX-style composition.

$nav({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <nav> element wrapper for JSX-style composition.

$ol({String? className, String? id, int? start, String? type, bool? reversed, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates an <ol> element wrapper for JSX-style composition.

$option({required String value, String? key, bool? disabled, bool? selected, Map<String, dynamic>? spread}) El

Creates an <option> element wrapper for JSX-style composition.

$p({String? key, String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <p> element wrapper for JSX-style composition.

$pre({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <pre> element wrapper for JSX-style composition.

$section({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <section> element wrapper for JSX-style composition.

$select({String? className, String? id, String? name, String? value, bool? disabled, bool? multiple, bool? required, Map<String, dynamic>? style, Map<String, dynamic>? props, void onChange(SyntheticEvent)?, void onFocus(SyntheticFocusEvent)?, void onBlur(SyntheticFocusEvent)?}) El

Creates a <select> element wrapper for JSX-style composition.

$span({String? key, String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread, void onClick()?}) El

Creates a <span> element wrapper for JSX-style composition.

$table({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <table> element wrapper for JSX-style composition.

$tbody({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <tbody> element wrapper for JSX-style composition.

$td({String? key, String? className, String? id, int? colSpan, int? rowSpan, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <td> element wrapper for JSX-style composition.

$textarea({String? className, String? id, String? name, String? value, String? placeholder, int? rows, int? cols, bool? disabled, bool? readOnly, bool? required, Map<String, dynamic>? style, Map<String, dynamic>? props, void onChange(SyntheticEvent)?, void onInput(SyntheticEvent)?, void onFocus(SyntheticFocusEvent)?, void onBlur(SyntheticFocusEvent)?}) El

Creates a <textarea> element wrapper for JSX-style composition.

$tfoot({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <tfoot> element wrapper for JSX-style composition.

$th({String? key, String? className, String? id, int? colSpan, int? rowSpan, String? scope, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <th> element wrapper for JSX-style composition.

$thead({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <thead> element wrapper for JSX-style composition.

$tr({String? key, String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <tr> element wrapper for JSX-style composition.

$ul({String? className, String? id, Map<String, dynamic>? style, Map<String, dynamic>? spread}) El

Creates a <ul> element wrapper for JSX-style composition.

$video({String? src, String? className, String? id, int? width, int? height, bool? controls, bool? autoplay, bool? loop, bool? muted, String? poster, Map<String, dynamic>? style, Map<String, dynamic>? props}) El

Creates a <video> element wrapper for JSX-style composition.

a({required String href, required String text, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) AElement

Create an a (anchor) element

abbr([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <abbr> element.

act(void callback()) → void

Wraps code that causes React state updates in an act() block.

actAsync(Future<void> callback()) Future<void>

Async version of act for operations that return a Future.

address([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <address> element.

aEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <a> element.

altGlyph([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <altGlyph> element (deprecated SVG).

altGlyphDef([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <altGlyphDef> element (deprecated SVG).

altGlyphItem([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <altGlyphItem> element (deprecated SVG).

animate([Map<String, Object?>? props]) ReactElement

Creates an <animate> element.

animateColor([Map<String, Object?>? props]) ReactElement

Creates an <animateColor> element (deprecated SVG).

animateMotion([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <animateMotion> element.

animateTransform([Map<String, Object?>? props]) ReactElement

Creates an <animateTransform> element.

area([Map<String, Object?>? props]) ReactElement

Creates an <area> element.

article([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <article> element.

aside([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <aside> element.

audio([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <audio> element.

b([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <b> element.

base([Map<String, Object?>? props]) ReactElement

Creates a <base> element.

bdi([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <bdi> element.

bdo([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <bdo> element.

big([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <big> element (deprecated HTML).

blockquote([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <blockquote> element.

body([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <body> element.

br([Map<String, Object?>? props]) ReactElement

Creates a <br> element.

button({required String text, void onClick()?, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) ButtonElement

Create a button element

canvas([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <canvas> element.

caption([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <caption> element.

circle([Map<String, Object?>? props]) ReactElement

Creates a <circle> element.

cite([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <cite> element.

clipPath([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <clipPath> element.

cloneElement(ReactElement element, [Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Clones and returns a new React element using element as the starting point.

code([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <code> element.

col([Map<String, Object?>? props]) ReactElement

Creates a <col> element.

colgroup([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <colgroup> element.

colorProfile([Map<String, Object?>? props]) ReactElement

Creates a <color-profile> element (deprecated SVG).

convertStyle(Map<String, dynamic> style) JSObject

Convert style map to JSObject for React inline styles Numeric values get 'px' suffix for size-related properties

createContext<T>(T defaultValue) Context<T>

Creates a Context object with the specified defaultValue.

createElement(JSAny type, [JSObject? props, JSAny? children]) ReactElement

Create a React element (convenience wrapper).

createElementWithChildren(JSAny type, JSObject? props, List<JSAny> children) ReactElement

Create a React element with multiple children using spread

createFunctionalComponent(ReactElement render(JSObject props)) JSFunction

Create a functional component - returns the component function itself.

createPortal(ReactElement children, JSObject container) ReactPortal

Renders a React element into a portal, allowing it to appear in a different part of the DOM tree.

createProps(Map<String, dynamic> props) JSObject

Create props object from a Map (with function conversion)

createRef<T>() Ref<T?>

Creates a Ref object that can be attached to a ReactElement via the ref prop.

createRoot(JSObject container) ReactRoot

Creates a React root for rendering into a DOM node (React 18+).

cursor([Map<String, Object?>? props]) ReactElement

Creates a <cursor> element (deprecated SVG).

dataEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <data> element.

datalist([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <datalist> element.

dd([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <dd> element.

defs([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <defs> element.

del([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <del> element.

desc([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <desc> element.

details([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <details> element.

dfn([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <dfn> element.

dialog([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <dialog> element.

discard([Map<String, Object?>? props]) ReactElement

Creates a <discard> element.

div({Map<String, dynamic>? props, Map<String, dynamic>? style, List<ReactElement>? children, String? className, ReactElement? child}) DivElement

Create a div element

dl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <dl> element.

domElement(String tagName, [Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a React element for the given HTML tag name.

dt([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <dt> element.

ellipse([Map<String, Object?>? props]) ReactElement

Creates an <ellipse> element.

em([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <em> element.

embed([Map<String, Object?>? props]) ReactElement

Creates an <embed> element.

fc(JSAny component, [Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a ReactElement from a registered function component.

feBlend([Map<String, Object?>? props]) ReactElement

Creates a <feBlend> element.

feColorMatrix([Map<String, Object?>? props]) ReactElement

Creates a <feColorMatrix> element.

feComponentTransfer([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <feComponentTransfer> element.

feComposite([Map<String, Object?>? props]) ReactElement

Creates a <feComposite> element.

feConvolveMatrix([Map<String, Object?>? props]) ReactElement

Creates a <feConvolveMatrix> element.

feDiffuseLighting([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <feDiffuseLighting> element.

feDisplacementMap([Map<String, Object?>? props]) ReactElement

Creates a <feDisplacementMap> element.

feDistantLight([Map<String, Object?>? props]) ReactElement

Creates a <feDistantLight> element.

feDropShadow([Map<String, Object?>? props]) ReactElement

Creates a <feDropShadow> element.

feFlood([Map<String, Object?>? props]) ReactElement

Creates a <feFlood> element.

feFuncA([Map<String, Object?>? props]) ReactElement

Creates a <feFuncA> element.

feFuncB([Map<String, Object?>? props]) ReactElement

Creates a <feFuncB> element.

feFuncG([Map<String, Object?>? props]) ReactElement

Creates a <feFuncG> element.

feFuncR([Map<String, Object?>? props]) ReactElement

Creates a <feFuncR> element.

feGaussianBlur([Map<String, Object?>? props]) ReactElement

Creates a <feGaussianBlur> element.

feImage([Map<String, Object?>? props]) ReactElement

Creates a <feImage> element.

feMerge([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <feMerge> element.

feMergeNode([Map<String, Object?>? props]) ReactElement

Creates a <feMergeNode> element.

feMorphology([Map<String, Object?>? props]) ReactElement

Creates a <feMorphology> element.

feOffset([Map<String, Object?>? props]) ReactElement

Creates a <feOffset> element.

fePointLight([Map<String, Object?>? props]) ReactElement

Creates a <fePointLight> element.

feSpecularLighting([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <feSpecularLighting> element.

feSpotLight([Map<String, Object?>? props]) ReactElement

Creates a <feSpotLight> element.

feTile([Map<String, Object?>? props]) ReactElement

Creates a <feTile> element.

feTurbulence([Map<String, Object?>? props]) ReactElement

Creates a <feTurbulence> element.

fieldset([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <fieldset> element.

figcaption([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <figcaption> element.

figure([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <figure> element.

filter([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <filter> element.

fireBlur(DomNode element) → void

Fires a blur event on the element.

fireChange(DomNode element, {String? value}) → void

Fires a change event on the element.

fireClick(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a click event on the element.

fireDoubleClick(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a double-click event on the element.

fireFocus(DomNode element) → void

Fires a focus event on the element.

fireInput(DomNode element, {String? value}) → void

Fires an input event on the element.

fireKeyDown(DomNode element, {String? key, int? keyCode}) → void

Fires a keydown event on the element.

fireKeyPress(DomNode element, {String? key, int? keyCode}) → void

Fires a keypress event on the element.

fireKeyUp(DomNode element, {String? key, int? keyCode}) → void

Fires a keyup event on the element.

fireMouseDown(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mousedown event on the element.

fireMouseEnter(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mouseenter event on the element.

fireMouseLeave(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mouseleave event on the element.

fireMouseOut(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mouseout event on the element.

fireMouseOver(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mouseover event on the element.

fireMouseUp(DomNode element, [Map<String, Object?>? eventInit]) → void

Fires a mouseup event on the element.

fireSubmit(DomNode element) → void

Fires a submit event on a form element.

flushSync(void callback()) → void

Lets you force React to flush any updates inside the provided callback synchronously.

font([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <font> element (deprecated SVG).

fontFace([Map<String, Object?>? props]) ReactElement

Creates a <font-face> element (deprecated SVG).

fontFaceFormat([Map<String, Object?>? props]) ReactElement

Creates a <font-face-format> element (deprecated SVG).

fontFaceName([Map<String, Object?>? props]) ReactElement

Creates a <font-face-name> element (deprecated SVG).

fontFaceSrc([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <font-face-src> element (deprecated SVG).

fontFaceUri([Map<String, Object?>? props]) ReactElement

Creates a <font-face-uri> element (deprecated SVG).

Create a footer element

foreignObject([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <foreignObject> element.

form([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <form> element.

forwardRef2(ForwardRefRenderFunction render, {String? displayName}) JSAny

Creates a React component that forwards the ref attribute to a child.

fragment({List<ReactElement>? children}) ReactElement

Creates a Fragment element that groups children without adding extra DOM nodes.

functionalComponent(String name, ReactElement render(JSObject props)) ReactElement

Create a React element with an inline functional component.

g([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <g> element (group).

glyph([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <glyph> element (deprecated SVG).

glyphRef([Map<String, Object?>? props]) ReactElement

Creates a <glyphRef> element (deprecated SVG).

h1(String text, {Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) H1Element

Create an h1 element

h2(String text, {Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) H2Element

Create an h2 element

h3([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <h3> element.

h4([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <h4> element.

h5([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <h5> element.

h6([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <h6> element.

hasAttribute(DomNode element, String name, [String? value]) bool

Checks if an element has the given attribute value.

hasClass(DomNode element, String className) bool

Checks if an element has the given class.

hasFocus(DomNode element) bool

Checks if an element has focus.

hasTextContent(DomNode element, String text) bool

Checks if an element has the given text content.

hasValue(DomNode element, String value) bool

Checks if an input element has the given value.

hatch([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <hatch> element.

hatchpath([Map<String, Object?>? props]) ReactElement

Creates a <hatchpath> element.

Creates a <head> element.

Create a header element

hgroup([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <hgroup> element.

hkern([Map<String, Object?>? props]) ReactElement

Creates a <hkern> element (deprecated SVG).

hr([Map<String, Object?>? props]) ReactElement

Creates an <hr> element.

htmlEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <html> element.

hydrateRoot(JSObject container, ReactElement initialChildren) ReactRoot

Creates a React root for hydrating server-rendered content (React 18+).

i([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <i> element.

iframe([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <iframe> element.

imageSvg([Map<String, Object?>? props]) ReactElement

Creates an <image> element (SVG).

img({required String src, String? alt, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) ImgElement

Create an img element

input({String? type, String? value, String? placeholder, void onChange(SyntheticEvent)?, void onInput(SyntheticEvent)?, void onFocus(SyntheticFocusEvent)?, void onBlur(SyntheticFocusEvent)?, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) InputElement

Create an input element

ins([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <ins> element.

isChecked(DomNode element) bool

Checks if a checkbox/radio is checked.

isCompositeComponent(JSAny? instance) bool

Returns true if instance is a composite component (created with registerFunctionComponent or forwardRef2).

isDisabled(DomNode element) bool

Checks if an element is disabled.

isDOMComponent(JSAny? instance) bool

Returns true if instance is a DOM component (such as <div> or <span>).

isElement(JSAny? object) bool

Returns true if object is a valid React element.

isEnabled(DomNode element) bool

Checks if an element is enabled (not disabled).

isInDocument(DomNode? element) bool

Checks if an element is in the document.

isValidElement(JSAny? object) bool

Returns true if the object is a valid React element.

isVisible(DomNode element) bool

Checks if an element is visible.

kbd([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <kbd> element.

keygen([Map<String, Object?>? props]) ReactElement

Creates a <keygen> element (deprecated HTML).

label([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <label> element.

lazy(Future<JSAny> load()) JSAny

Creates a lazy-loaded component using dynamic imports.

legend([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <legend> element.

li(String text, {Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) LiElement

Create a li element

line([Map<String, Object?>? props]) ReactElement

Creates a <line> element.

linearGradient([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <linearGradient> element.

Creates a <link> element.

mainEl({List<ReactElement>? children, ReactElement? child, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) MainElement

Create a main element

mapEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <map> element.

mark([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <mark> element.

marker([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <marker> element.

mask([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <mask> element.

memo2(JSAny component, {bool arePropsEqual(Map<String, Object?> prevProps, Map<String, Object?> nextProps)?}) JSAny

Creates a memoized version of a component that only re-renders when its props have changed.

Creates a <menu> element.

Creates a <menuitem> element (deprecated HTML).

mesh([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <mesh> element.

meshgradient([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <meshgradient> element.

meshpatch([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <meshpatch> element.

meshrow([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <meshrow> element.

meta([Map<String, Object?>? props]) ReactElement

Creates a <meta> element.

metadata([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <metadata> element.

meter([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <meter> element.

missingGlyph([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <missing-glyph> element (deprecated SVG).

mpath([Map<String, Object?>? props]) ReactElement

Creates a <mpath> element.

Creates a <nav> element.

noscript([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <noscript> element.

objectEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <object> element.

ol([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <ol> element.

optgroup([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <optgroup> element.

option([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <option> element.

output([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <output> element.

param([Map<String, Object?>? props]) ReactElement

Creates a <param> element.

path([Map<String, Object?>? props]) ReactElement

Creates a <path> element.

patternSvg([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <pattern> element.

pEl(String text, {Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) PElement

Create a p element

picture([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <picture> element.

polygon([Map<String, Object?>? props]) ReactElement

Creates a <polygon> element.

polyline([Map<String, Object?>? props]) ReactElement

Creates a <polyline> element.

portal([Map<String, Object?>? props]) ReactElement

Creates a <portal> element.

pre([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <pre> element.

progress([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <progress> element.

q([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <q> element.

radialGradient([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <radialGradient> element.

rect([Map<String, Object?>? props]) ReactElement

Creates a <rect> element.

registerFunctionComponent(DartFunctionComponent dartComponent, {String? displayName}) JSAny

Creates a React function component from a Dart function.

render(ReactElement element) RenderResult

Renders a React element into a detached DOM node for testing.

renderIntoDocument(ReactElement element) JSAny?

Renders a React element into a detached DOM node (legacy API).

rp([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <rp> element.

rt([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <rt> element.

ruby([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <ruby> element.

s([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <s> element.

samp([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <samp> element.

script([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <script> element.

Creates a <search> element.

section([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <section> element.

select([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <select> element.

slot([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <slot> element.

small([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <small> element.

solidcolor([Map<String, Object?>? props]) ReactElement

Creates a <solidcolor> element.

source([Map<String, Object?>? props]) ReactElement

Creates a <source> element.

span(String text, {Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) SpanElement

Create a span element

stop([Map<String, Object?>? props]) ReactElement

Creates a <stop> element.

strictMode({ReactElement? child, List<ReactElement>? children}) ReactElement

Creates a StrictMode wrapper element.

strong([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <strong> element.

styleEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <style> element.

sub([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <sub> element.

summaryEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <summary> element.

sup([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <sup> element.

suspense({required ReactElement fallback, ReactElement? child, List<ReactElement>? children}) ReactElement

Creates a Suspense element that displays fallback while child is loading.

svg([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <svg> element.

svgElement(String tagName, [Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a React element for the given SVG tag name.

svgSet([Map<String, Object?>? props]) ReactElement

Creates a <set> element (SVG).

svgSwitch([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <switch> element (SVG).

symbol([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <symbol> element.

table([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <table> element.

tbody([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <tbody> element.

td([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <td> element.

templateEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <template> element.

textarea([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <textarea> element.

textPath([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <textPath> element.

textSvg([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <text> element.

tfoot([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <tfoot> element.

th([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <th> element.

thead([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <thead> element.

time([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <time> element.

titleEl([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <title> element.

titleSvg([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <title> element (SVG).

tr([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <tr> element.

track([Map<String, Object?>? props]) ReactElement

Creates a <track> element.

tref([Map<String, Object?>? props]) ReactElement

Creates a <tref> element (deprecated SVG).

tspan([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <tspan> element.

u([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <u> element.

ul({List<LiElement>? children, Map<String, dynamic>? props, Map<String, dynamic>? style, String? className}) UlElement

Create a ul element

unknown([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates an <unknown> element.

use([Map<String, Object?>? props]) ReactElement

Creates a <use> element.

useCallback(Function callback, List<Object?> dependencies) JSFunction

Returns a memoized version of callback that only changes if one of the dependencies has changed.

useContext<T>(Context<T> context) → T

Accepts a Context object and returns the current context value for that context.

useDebugValue<T>(T value, [String format(T)?]) → void

Displays value as a label for a custom hook in React DevTools.

useEffect(Object? sideEffect(), [List<Object?>? dependencies]) → void

Runs sideEffect after every completed render of a function component.

useImperativeHandle<T>(Object? ref, T createHandle(), [List<Object?>? dependencies]) → void

Customizes the ref value that is exposed to parent components when using forwardRef2 by setting ref.current to the return value of createHandle.

useLayoutEffect(Object? sideEffect(), [List<Object?>? dependencies]) → void

Runs sideEffect synchronously after a function component renders, but before the screen is updated.

useMemo<T>(T createFunction(), [List<Object?>? dependencies]) → T

Returns a memoized version of the return value of createFunction.

userClear(DomNode element) Future<void>

Simulates clearing an input field.

userClick(DomNode element) Future<void>

Simulates a user clicking on an element.

userDblClick(DomNode element) Future<void>

Simulates a user double-clicking on an element.

useReducer<TState, TAction>(TState reducer(TState state, TAction action), TState initialState) ReducerHook<TState, TAction>

Initializes state of a function component to initialState and creates a dispatch method.

useReducerLazy<TState, TAction, TInit>(TState reducer(TState state, TAction action), TInit initialArg, TState init(TInit)) ReducerHook<TState, TAction>

Initializes state of a function component to init(initialArg) and creates dispatch method.

useRef<T>([T? initialValue]) Ref<T?>

Returns an empty mutable Ref object.

useRefInit<T>(T initialValue) Ref<T>

Returns a mutable Ref object with Ref.current property initialized to initialValue.

userHover(DomNode element) Future<void>

Simulates hovering over an element.

userPaste(DomNode element, String text) Future<void>

Simulates pasting text into an element.

userType(DomNode element, String text) Future<void>

Simulates a user typing text into an input.

userUnhover(DomNode element) Future<void>

Simulates unhovering from an element.

useState<T>(T initialValue) StateHook<T>

Adds local state to a function component by returning a StateHook with StateHook.value initialized to initialValue.

useStateJS(JSAny? initialValue) StateHookJS

Adds local state for JS interop types to a function component.

useStateJSArray<T extends JSAny>(JSAny? initialValue) StateHookJSArray<T>

Adds local state for lists of JS objects to a function component.

useStateLazy<T>(T init()) StateHook<T>

Adds local state to a function component by returning a StateHook with StateHook.value initialized to the return value of init.

variable([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <var> element.

video([Map<String, Object?>? props, List<ReactElement>? children]) ReactElement

Creates a <video> element.

view([Map<String, Object?>? props]) ReactElement

Creates a <view> element.

vkern([Map<String, Object?>? props]) ReactElement

Creates a <vkern> element (deprecated SVG).

waitFor<T>(T callback(), {Duration timeout = const Duration(seconds: 1), Duration interval = const Duration(milliseconds: 50)}) Future<T>

Waits for a condition to be true.

waitForElementToBeRemoved(DomNode? callback(), {Duration timeout = const Duration(seconds: 1), Duration interval = const Duration(milliseconds: 50)}) Future<void>

Waits for an element to be removed from the DOM.

wbr([Map<String, Object?>? props]) ReactElement

Creates a <wbr> element.

Typedefs

DartFunctionComponent = ReactElement Function(Map<String, Object?> props)
A Dart function component that takes a props Map and returns a ReactElement.
ForwardRefRenderFunction = ReactElement Function(Map<String, Object?> props, JsRef? ref)
Typedef for a function component that receives props and a forwarded ref.

Exceptions / Errors

TestingLibraryException

Exception thrown by Testing Library queries.