getFieldsValues method

Map<String, Object?> getFieldsValues(
  1. Map<String, Object?> map, {
  2. Iterable<String>? fields,
})

Returns a Map with the table fields values populated from the provided map.

The field name resolution is case insensitive. See getFieldValue.

Implementation

Map<String, Object?> getFieldsValues(Map<String, Object?> map,
    {Iterable<String>? fields}) {
  var fieldsNames = this.fieldsNames;

  if (fields != null) {
    var fieldsSimple = fields.map(fieldToSimpleKey).toList();

    fieldsNames = fieldsNames
        .mapIndexed((i, e) => MapEntry(e, _fieldsNamesSimple[i]))
        .where((e) => fieldsSimple.contains(e.value))
        .map((e) => e.key)
        .toList();
  }

  return getFieldsValuesFromMap(fieldsNames, map,
      fieldsNamesIndexes: _fieldsNamesIndexes,
      fieldsNamesLC: _fieldsNamesLC,
      fieldsNamesSimple: _fieldsNamesSimple,
      includeAbsentFields: true);
}