encodeList static method

String encodeList(
  1. List<ClassHeapStats> data
)

Given a list of HeapSample, encode as a Json string.

Implementation

static String encodeList(List<ClassHeapStats> data) {
  final allocationJson = AllocationMemoryJson();

  final result = StringBuffer();

  // Iterate over all ClassHeapDetailStats collected.
  data.map((f) {
    final encodedValue = result.isNotEmpty
        ? allocationJson.encodeAnother(f)
        : allocationJson.encode(f);
    result.write(encodedValue);
  }).toList();

  return '$header$result${MemoryJson.trailer}';
}