only method
Returns a new map containing only the entries in keys.
Example:
final style = {'color': 'red', 'font-size': '10px', 'font-weight': 'bold'};
final onlyColorAndSize = style.only(['color', 'font-size']);
// returns: {'color': 'red', 'font-size': '10px'}
Implementation
Map<String, String> only(List<String> keys) {
final map = <String, String>{};
for (final key in keys) if (containsKey(key)) map[key] = this[key]!;
return map;
}