mergeWith method

Record mergeWith(
  1. Record otherRecord
)

Merge <@code otherRecord> to this record And return the result as a new record.

Implementation

Record mergeWith(Record otherRecord) {
  final newRecord = Record();
  _fields.forEach((key, value) {
    newRecord.addField(key, value);
  });

  otherRecord.getFieldNames().forEach((fieldName) {
    newRecord.addField(fieldName, otherRecord.getField(fieldName));
  });
  return newRecord;
}