one2Many<U extends FieldWidgets<T>> method

void one2Many<U extends FieldWidgets<T>>(
  1. U create()
)

Convert a list item into separate objects.

Implementation

void one2Many<U extends FieldWidgets<T>>(
  U Function() create,
) {
  if (value is! List<DataFieldItem>) {
    return;
  }
  final List<DataFieldItem> dataItems = value;
  value = null;

  final fields = <U>[];

  for (final item in dataItems) {
    final field = create()
      ..value = item.value
      ..initialValue = item.value
      ..type = item.type
      ..label = item.label
      ..id = item.id;

    fields.add(field);
  }
  items = fields;
}