map2Json function

String map2Json(
  1. Map? map
)

返回json格式的String

Implementation

String map2Json(Map? map) {
  if (map == null) {
    return '';
  }
  StringBuffer sb = StringBuffer();
  sb.writeln('{');
  map.forEach((key, value) => sb.writeln('$key:$value'));
  sb.write('}');
  return sb.toString();
}