copyFieldValueFromEntity method

void copyFieldValueFromEntity(
  1. DfBaseEntity<DfBaseField> entity,
  2. {bool ignoreFieldNameCase = true}
)

Implementation

void copyFieldValueFromEntity(DfBaseEntity entity, {bool ignoreFieldNameCase = true}) {
  if (entity == null || entity.fields() == null || fields() == null) return;
  entity.fields().forEach((field1) {
    fields().forEach((field2) {
      DfBaseField f1 = field1;
      DfBaseField f2 = field2;
      String f1Name = f1.name;
      String f2Name = f2.name;
      if (ignoreFieldNameCase) {
        f1Name = f1Name.toLowerCase();
        f2Name = f2Name.toLowerCase();
      }
      if (f1Name == f2Name) {
        f2.setObjectValue(f1.getObjectValue());
      }
    });
  });
}