buildCustom method

  1. @override
Widget buildCustom({
  1. ChildWidgetBuilder? childBuilder,
  2. required BuildContext context,
  3. required JsonWidgetData data,
  4. Key? key,
})
override

Custom builder that subclasses must override and implement to return the actual Widget to be placed on the tree.

Implementation

@override
Widget buildCustom({
  ChildWidgetBuilder? childBuilder,
  required BuildContext context,
  required JsonWidgetData data,
  Key? key,
}) {
  final args = Map.from(data.jsonWidgetArgs);
  args.remove('dynamic');
  args['children'] = [];
  final map = {
    'id': data.jsonWidgetId,
    'type': builderType,
    'args': args,
  };

  if (data.jsonWidgetRegistry.getValue(data.jsonWidgetId) == null) {
    data.jsonWidgetRegistry.setValue(
      data.jsonWidgetId,
      initState
          .map(
            (values) => DynamicValuesFactory.create(values),
          )
          .toList(),
    );
  }

  return _DynamicWidget(
    data: JsonWidgetData.fromDynamic(map, registry: data.jsonWidgetRegistry),
    childTemplate: childTemplate,
    childBuilder: childBuilder,
    key: key,
  );
}