getFirstValue method
Returns the first value for key
, if present.
Implementation
String? getFirstValue(K key, {bool ignoreCase = false}) {
var prev = ignoreCase ? getIgnoreCase(key) : get(key);
if (prev == null) return null;
if (prev is String) return prev;
if (prev is List<String>) return prev.isEmpty ? null : prev.first;
if (prev is List) return prev.isEmpty ? null : prev.first.toString();
return null;
}