asStrings method
多字段解析Strings
Implementation
String asStrings(List<String> keys, [String? defValue]) {
if (this == null) return defValue ?? '';
List<Object>? _values;
for (String key in keys) {
Object? value = this![key];
if (value == null) continue;
if (value is String) {
if (value.isEmpty) continue;
return value;
} else {
_values ??= [];
_values.add(value);
}
}
if (_values != null && _values.isNotEmpty) {
return _values[0].toString();
}
return defValue ?? "";
}