mapToCsv function

String mapToCsv(
  1. Map input
)

Converts a map to a CSV string.

Implementation

String mapToCsv(Map<dynamic, dynamic> input) {
  var output = '';
  for (final entry in input.entries) {
    final key = entry.key;
    dynamic value = entry.value;
    if (value is Map) {
      value = mapToCsv(value);
    } else if (value is List) {
      value = value.join(',');
    }
    output += '"$key","$value"\n';
  }
  return output;
}