UiComponent<TProps extends UiProps> class abstract

The basis for an over_react component.

Includes support for strongly-typed UiProps and utilities for prop and CSS classname forwarding.

Prop and CSS className forwarding when your component renders a composite component:

@Component()
class YourComponent extends UiComponent<YourProps> {
  Map getDefaultProps() => (newProps()
    ..aPropOnYourComponent = /* default value */
  );

  @override
  render() {
    var classes = forwardingClassNameBuilder()
      ..add('your-component-base-class')
      ..add('a-conditional-class', shouldApplyConditionalClass);

    return (SomeChildComponent()
      ..addProps(copyUnconsumedProps())
      ..className = classes.toClassName()
    )(props.children);
  }
}

Prop and CSS className forwarding when your component renders a DOM component:

@Component()
class YourComponent extends UiComponent<YourProps> {
  @override
  render() {
    var classes = forwardingClassNameBuilder()
      ..add('your-component-base-class')
      ..add('a-conditional-class', shouldApplyConditionalClass);

    return (Dom.div()
      ..addProps(copyUnconsumedDomProps())
      ..className = classes.toClassName()
    )(props.children);
  }
}

Related: UiStatefulComponent

Deprecated. Use UiComponent2 instead. Will be removed in the 4.0.0 release.

Inheritance
  • Object
  • Component
  • UiComponent
Implementers
Annotations

Constructors

UiComponent()

Properties

childContextKeys Iterable<String>
The keys this component uses in its child context map (returned by getChildContext).
no setterinherited
consumedProps Iterable<ConsumedProps>?
The props for the non-forwarding props defined in this component.
no setter
context ↔ dynamic
The React context map of this component, passed down from its ancestors' getChildContext value.
getter/setter pairinherited
contextKeys Iterable<String>
The keys of context used by this component.
no setterinherited
displayName String?
Allows the ReactJS displayName property to be set for debugging purposes.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
jsThis → dynamic
The JavaScript ReactComponent instance of this Component returned by render.
no setterinherited
nextContext Map?
Private reference to the value of context for the upcoming render cycle.
getter/setter pairinherited
nextProps Map?
Reference to the value of props for the upcoming render cycle.
getter/setter pairinherited
nextState Map
Public getter for _nextState.
no setterinherited
prevContext Map?
Reference to the value of context from the previous render cycle, used internally for proxying the ReactJS lifecycle method.
getter/setter pairinherited
prevState Map?
Reference to the value of state from the previous render cycle, used internally for proxying the ReactJS lifecycle method and componentDidUpdate.
getter/setter pairinherited
props ↔ TProps
A typed props object corresponding to the current untyped props Map (unwrappedProps).
getter/setter pairoverride
ref ↔ RefMethod
DEPRECATED.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setStateCallbacks List
The List of callbacks to be called after the component has been updated from a call to setState.
no setterinherited
state Map
ReactJS Component state.
getter/setter pairinherited
transactionalSetStateCallbacks List
The List of transactional setState callbacks to be called before the component updates.
no setterinherited
unwrappedProps Map
The props Map that will be used to create the typed props object.
getter/setter pair

Methods

awaitBeforeDispose<T>(Future<T> future) Future<T>
Add future to a list of futures that will be awaited before the object is disposed.
inherited
componentDidMount() → void
ReactJS lifecycle method that is invoked once, only on the client (not on the server), immediately after the initial rendering occurs.
inherited
componentDidUpdate(Map prevProps, Map prevState) → void
ReactJS lifecycle method that is invoked immediately after the Component's updates are flushed to the DOM.
inherited
componentWillMount() → void
ReactJS lifecycle method that is invoked once, both on the client and server, immediately before the initial rendering occurs.
override
componentWillReceiveProps(Map nextProps) → void
ReactJS lifecycle method that is invoked when a Component is receiving newProps.
override
componentWillReceivePropsWithContext(Map newProps, dynamic nextContext) → void

UNSUPPORTED IN COMPONENT2

This API was never stable in any version of ReactJS, and was replaced with a new, incompatible context API in ReactJS 16.

This will be completely removed alongside the Component class.

inherited
componentWillUnmount() → void
ReactJS lifecycle method that is invoked immediately before a Component is unmounted from the DOM.
inherited
componentWillUpdate(Map nextProps, Map nextState) → void
ReactJS lifecycle method that is invoked immediately before rendering when nextProps or nextState are being received.
inherited
componentWillUpdateWithContext(Map nextProps, Map nextState, Map? nextContext) → void

DEPRECATED - DO NOT USE

This API was never stable in any version of ReactJS, and was replaced with a new, incompatible context API in ReactJS 16.

This will be completely removed alongside the Component class.

inherited
copyProps({bool omitReservedReactProps = true, bool onlyCopyDomProps = false, Iterable? keysToOmit, Iterable<Iterable>? keySetsToOmit}) Map
Returns a copy of this component's props with React props optionally omitted, and with the specified keysToOmit and keySetsToOmit omitted.
copyUnconsumedDomProps() Map
Returns a copy of this component's props with keys found in consumedProps and non-DOM props omitted.
copyUnconsumedProps() Map
Returns a copy of this component's props with keys found in consumedProps omitted.
forwardingClassNameBuilder() ClassNameBuilder
Returns a new ClassNameBuilder with className and blacklist values added from CssClassPropsMixin.className and CssClassPropsMixin.classNameBlacklist, if they are specified.
getChildContext() Map<String, dynamic>
Returns a Map of context to be passed to descendant components.
inherited
getDefaultProps() Map
Invoked once and cached when registerComponent is called. Values in the mapping will be set on props if that prop is not specified by the parent component.
inherited
getInitialState() Map
Invoked once before the Component is mounted. The return value will be used as the initial value of state.
inherited
getManagedDelayedFuture<T>(Duration duration, T callback()) Future<T>
Creates a Future that will complete, with the value returned by callback, after the given amount of time has elapsed.
inherited
getManagedDisposer(Disposer disposer) → ManagedDisposer
Automatically handle arbitrary disposals using a callback.
inherited
getManagedPeriodicTimer(Duration duration, void callback(Timer timer)) Timer
Creates a periodic Timer that will be cancelled if active upon disposal.
inherited
getManagedTimer(Duration duration, void callback()) Timer
Creates a Timer instance that will be cancelled if active upon disposal.
inherited
initComponentInternal(Map props, void _jsRedraw(), [RefMethod? ref, dynamic _jsThis, Map? context]) → dynamic
inherited
initStateInternal() → dynamic
inherited
listenToStream<T>(Stream<T> stream, void onData(T event), {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<T>
Returns a StreamSubscription which handles events from the stream using the provided onData, onError and onDone handlers.
inherited
manageAndReturnDisposable(Disposable disposable) → Disposable
inherited
manageAndReturnTypedDisposable<T extends Disposable>(T disposable) → T
Automatically dispose another object when this object is disposed.
inherited
manageCompleter<T>(Completer<T> completer) Completer<T>
Ensure that a completer is completed when the object is disposed.
inherited
manageDisposable(Disposable disposable) → void
inherited
manageDisposer(Disposer disposer) → void
DEPRECATED. Use getManagedDisposer instead.
inherited
manageStreamController(StreamController controller) → void
Automatically cancel a stream controller when this object is disposed.
inherited
manageStreamSubscription(StreamSubscription subscription) → void
DEPRECATED. Use listenToStream instead.
inherited
newProps() → TProps
Returns a typed props object backed by a new Map.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redraw([dynamic callback()?]) → void
Force a call to render by calling setState, which effectively "redraws" the Component.
inherited
render() → dynamic
Required.
inherited
replaceState(Map? newState, [dynamic callback()?]) → void
Set _nextState to provided newState value and force a re-render.
inherited
setState(covariant dynamic newState, [dynamic callback()?]) → void
Triggers a rerender with new state obtained by shallow-merging newState into the current state.
inherited
shouldComponentUpdate(Map nextProps, Map nextState) bool
ReactJS lifecycle method that is invoked before rendering when nextProps or nextState are being received.
inherited
shouldComponentUpdateWithContext(Map nextProps, Map nextState, Map? nextContext) bool?

DEPRECATED - DO NOT USE

This API was never stable in any version of ReactJS, and was replaced with a new, incompatible context API in ReactJS 16.

This will be completely removed alongside the Component class.

inherited
toString() String
A string representation of this object.
inherited
transferComponentState() → void
Transfers Component _nextState to state, and state to prevState.
inherited
typedPropsFactory(Map propsMap) → TProps
Returns a typed props object backed by the specified propsMap.
validateProps(Map appliedProps) → void
Throws a PropError if appliedProps are invalid.
validateRequiredProps(Map appliedProps) → void
Validates that props with the @requiredProp annotation are present.

Operators

operator ==(Object other) bool
The equality operator.
inherited