react
library
Constants
-
clientOnly
→ const ClientOnly
-
-
reactAny
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
Any value, including
null.
-
reactBool
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A non-null boolean.
-
reactComponent
→ const ReactComponent
-
-
reactHostValue
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A non-null host value owned by a renderer.
-
reactInt
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A non-null integer.
-
reactNullableString
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A nullable string.
-
reactString
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A non-null string.
-
reactVoid
→ const ({Null codecId, Null hostNamespace, ReactValueKind kind, bool nullable, Null typeId})
-
A callback that returns no value.
Functions
-
button({void onClick()?, bool? disabled, String? className, ReactChildren children = const [], String? key})
→ ReactNode
-
-
component<P>(ComponentId id, {ReactComponentMetadata? metadata})
→ ReactComponentFactory<P>
-
Creates a typed factory for a generated or registered component.
-
createContext<T>(T defaultValue)
→ ReactContext<T>
-
Creates a context definition.
-
createPortal(ReactChildren children, Object container, {String? key})
→ ReactNode
-
Creates a portal node.
-
div({Map<String, Object?> props = const {}, ReactChildren children = const [], String? key})
→ ReactNode
-
-
each<T>(Iterable<T> values, ReactNode builder(T value, int index))
→ Iterable<ReactNode>
-
Builds one child for each item in
values.
-
errorBoundary({required ReactChildren children, required ReactNode fallback, void onError(Object error, StackTrace stack)?})
→ ReactNode
-
Creates an error-boundary node.
-
foreignComponent(String name, {Map<String, Object?> props = const {}, String? key, ReactChildren children = const []})
→ ForeignComponent
-
Creates a node for a component registered by a JavaScript/TypeScript
module.
-
forwardRef<P, T>(ForwardRefRender<P, T> render)
→ ForwardRefComponent<P, T>
-
Marks a component as receiving a forwarded ref.
-
fragment(ReactChildren children, {String? key})
→ ReactNode
-
Groups
children without adding a host element.
-
joinClassNames(Object? first, [Object? second, Object? third, Object? fourth])
→ String
-
Joins conditional class names into one stable string.
-
lazy<P>(LazyComponentLoader<P> load)
→ LazyComponent<P>
-
Defers loading a component until it is rendered.
-
memo<P>(ReactComponentBuilder<P> component, {PropsAreEqual<P>? arePropsEqual})
→ ReactComponentBuilder<P>
-
Marks
component for memoization.
-
normalizeChildren(ReactChildren children)
→ List<ReactNode>
-
Normalizes Dart-friendly child values into the portable React node model.
-
provideContext<T>(ReactContext<T> context, T value, ReactChildren children)
→ ReactNode
-
Creates a provider node for
context.
-
runWithReactRuntime<T>(ReactRuntime runtime, T callback())
→ T
-
-
strictMode(ReactChildren children)
→ ReactNode
-
Creates a strict-mode boundary node.
-
suspense({required ReactNode fallback, required ReactChildren children})
→ ReactNode
-
Creates a Suspense boundary node.
-
text(Object value)
→ Text
-
Converts a scalar value to a React text node.
-
unless(bool condition, ReactNode child)
→ ReactNode?
-
Returns
child when condition is false, otherwise an empty node.
-
unsupportedReactFeature(String feature)
→ Never
-
Throws a consistent error for a runtime feature that is only stubbed.
-
useActionState<T, A>(Action<T, A> action, T initialState, [String? permalink])
→ (T, void Function(A))
-
Returns action state and a dispatcher for async actions.
-
useCallback<T extends Function>(T callback, [List<Object?>? deps])
→ T
-
Returns a memoized callback until
deps changes.
-
useContext<T>(ReactContext<T> context)
→ T
-
Reads the nearest value for
context.
-
useDebugValue(Object? value, [String format(Object? value)?])
→ void
-
Associates debugging information with the current hook.
-
useDeferredValue<T>(T value, [T? initialValue])
→ T
-
Returns a deferred version of
value.
-
useEffect(EffectCallback effect, [List<Object?>? deps])
→ void
-
Registers a passive effect and optional cleanup.
-
useId()
→ String
-
Returns a stable identifier suitable for matching server and client trees.
-
useImperativeHandle<T>(ReactRef<T>? ref, T create(), [List<Object?>? deps])
→ void
-
Customizes the value exposed through
ref.
-
useLayoutEffect(EffectCallback effect, [List<Object?>? deps])
→ void
-
Registers an effect that runs before the browser paints.
-
useMemo<T>(T factory(), [List<Object?>? deps])
→ T
-
Returns a cached calculation until
deps changes.
-
useOptimistic<T, A>(T state, T update(T state, A action))
→ (T, void Function(A))
-
Returns optimistic state and a dispatcher for optimistic actions.
-
useReducer<T, A>(T reducer(T state, A action), T initialState, [T initializer(T initialState)?])
→ (T, void Function(A))
-
Returns state from a reducer and a dispatch function.
-
useRef<T>([T? initialValue])
→ ReactRef<T>
-
Returns a stable mutable ref object.
-
useState<T>(T initial)
→ (T, StateSetter<T>)
-
Returns state and a setter for the current component.
-
useStateController<T>(T initial)
→ StateController<T>
-
Returns the current state value and its setter as one typed object.
-
useStateLazy<T>(T initializer())
→ (T, StateSetter<T>)
-
Lazily initializes state.
-
useStateWithUpdater<T>(T initial)
→ (T, StateSetter<T>)
-
Returns state with a setter that supports functional updates.
-
useSyncExternalStore<T>(StoreSubscribe subscribe, Snapshot<T> getSnapshot, [Snapshot<T>? getServerSnapshot])
→ T
-
Subscribes to an external store with an SSR snapshot when provided.
-
useTransition()
→ (bool, void Function(TransitionWork ))
-
Returns pending state and a transition starter.
-
when(bool condition, ReactNode child)
→ ReactNode?
-
Returns
child when condition is true, otherwise an empty node.
Typedefs
-
Action<T, A>
= FutureOr<T> Function(T previousState, A action)
-
A future-compatible action result for useActionState.
-
EffectCallback
= dynamic Function()
-
A passive or layout effect callback.
-
EffectCleanup
= void Function()
-
A callback returned by an effect to clean up its subscription.
-
ForwardRefRender<P, T>
= ReactNode Function(P props, ReactRef<T> ref)
-
A component render function that receives a forwarded ref.
-
LazyComponentLoader<P>
= Future<ReactComponentBuilder<P>> Function()
-
A component loader used by lazy.
-
PropsAreEqual<P>
= bool Function(P previous, P next)
-
Describes a memoized component comparison.
-
ReactCallbackSignature
= ({bool asynchronous, List<ReactValueSpec> positional, ReactValueSpec result})
-
Complete callback signature metadata.
-
ReactChildren
= Iterable<Object?>
-
Values accepted by ergonomic React child APIs.
-
ReactComponentBuilder<P>
= ReactNode Function(P props)
-
A Dart component function that receives props and returns a node.
-
ReactRefCallback<T>
= void Function(T? value)
-
A generic ref callback.
-
ReactValueSpec
= ({String? codecId, String? hostNamespace, ReactValueKind kind, bool nullable, String? typeId})
-
Specification for a single callback argument or return value.
-
Snapshot<T>
= T Function()
-
A snapshot reader for useSyncExternalStore.
-
StoreSubscribe
= void Function() Function(void ())
-
A callback that subscribes to an external store and returns its cleanup.
-
TransitionWork
= void Function()
-
The work started by useTransition.