getFields method

List<ApiRequestMapEntity> getFields(
  1. BuildContext context,
  2. List<ApiRequestMapEntity> originalFields,
  3. List<RequestActionFieldEntity> newFields,
  4. int loop,
)

Implementation

List<ApiRequestMapEntity> getFields(
  BuildContext context,
  List<ApiRequestMapEntity> originalFields,
  List<RequestActionFieldEntity> newFields,
  int loop,
) {
  return originalFields.map((e) {
    final index = newFields.indexWhere((element) => element.id == e.id);
    if (index == -1) return e;
    return e.copyWith(
      value: newFields[index].value.get(
            context: context,
            loop: loop,
          ),
    );
  }).toList();
}