listStringValue method

List<String> listStringValue(
  1. String key, [
  2. List<String> defValue = const <String>[]
])

Implementation

List<String> listStringValue(String key, [List<String> defValue = const <String>[]]) {
  if (!containsKey(key)) {
    return defValue;
  } else if (this[key] is List) {
    return this[key];
  } else if (this[key] is String) {
    String valueStr = this[key];
    try {
      var value = json.decode(valueStr);
      if(value is List<String>) {
        return value;
      }
    } catch(e) {
      return defValue;
    }
    return  defValue;
  } else {
    return defValue;
  }
}