build method

Widget build(
  1. BuildContext context,
  2. FullyQualifiedWidgetName widget,
  3. DynamicContent data,
  4. RemoteEventHandler remoteEventTarget,
)

Build the root widget of a Remote Widget subtree.

The widget is identified by a FullyQualifiedWidgetName, which identifies a library and a widget name. The widget does not strictly have to be in that library, so long as it is in that library's dependencies.

The data for the widget is given by the data argument. That object can be updated independently, the widget will rebuild appropriately as it changes.

The remoteEventTarget argument is the callback that the RFW runtime will invoke whenever a remote widget event handler is triggered.

Implementation

Widget build(
  BuildContext context,
  FullyQualifiedWidgetName widget,
  DynamicContent data,
  RemoteEventHandler remoteEventTarget,
) {
  _CurriedWidget? boundWidget = _widgets[widget];
  if (boundWidget == null) {
    _checkForImportLoops(widget.library);
    boundWidget = _applyConstructorAndBindArguments(
      widget,
      const <String, Object?>{},
      const <String, Object?>{},
      -1,
      <FullyQualifiedWidgetName>{},
      null,
    );
    _widgets[widget] = boundWidget;
  }
  return boundWidget.build(context, data, remoteEventTarget, const <_WidgetState>[]);
}