writeParamIfnotNull static method

String writeParamIfnotNull(
  1. Map maps
)

Implementation

static String writeParamIfnotNull(Map maps) {
  var theString = [];

  maps.forEach((key, value) {
    if (value != null) {
      if (value is String) value = "'$value'";
      if (value is List) value = "[${value.join(',')}]";
      if (value is Map) value = JsonEncoder.withIndent('').convert(value);
      theString.add('$key: ${value}');
    }
  });

  return theString.join(', ');
}