removeKeys method
Returns true after removing all keys in removeKeysList from this map.
When recurseChildValues is true (default), keys are also removed from
nested Map<String, dynamic> values.
Implementation
@useResult
bool removeKeys(List<String>? removeKeysList, {bool recurseChildValues = true}) {
if (removeKeysList == null || removeKeysList.isEmpty) {
return false;
}
removeWhere((String key, _) => removeKeysList.contains(key));
if (recurseChildValues) {
// ignore: require_future_error_handling -- updateAll is synchronous; no future to handle
updateAll(
(String _, dynamic value) {
// ignore: unused_result, saropa_lints/avoid_ignoring_return_values -- recursive in-place mutation; bool result intentionally discarded
if (value is Map<String, dynamic>) value.removeKeys(removeKeysList);
return value;
},
);
}
return true;
}