handleString static method

String handleString(
  1. Map<String, dynamic> json,
  2. String key, {
  3. String defaultValue = "",
})

Implementation

static String handleString(Map<String, dynamic> json, String key,
    {String defaultValue = ""}) {
  var backStr = defaultValue;
  if (json.containsKey(key)) {
    var tmp = json[key];
    if (tmp is int || tmp is double || tmp is String) {
      backStr = '${json[key]}';
    } else {
      backStr = defaultValue;
    }
  } else {
    backStr = defaultValue;
  }
  return backStr;
}