void setupTraces()

in packages/devtools_app/lib/src/memory/memory_android_chart.dart [181:342]


  void setupTraces() {
    if (_chartController.traces.isNotEmpty) {
      assert(_chartController.traces.length == TraceName.values.length);

      final stackIndex = TraceName.stack.index;
      assert(_chartController.trace(stackIndex).name ==
          TraceName.values[stackIndex].toString());

      final graphicsIndex = TraceName.graphics.index;
      assert(_chartController.trace(graphicsIndex).name ==
          TraceName.values[graphicsIndex].toString());

      final nativeHeapIndex = TraceName.nativeHeap.index;
      assert(_chartController.trace(nativeHeapIndex).name ==
          TraceName.values[nativeHeapIndex].toString());

      final javaHeapIndex = TraceName.javaHeap.index;
      assert(_chartController.trace(javaHeapIndex).name ==
          TraceName.values[javaHeapIndex].toString());

      final codeIndex = TraceName.code.index;
      assert(_chartController.trace(codeIndex).name ==
          TraceName.values[codeIndex].toString());

      final otherIndex = TraceName.other.index;
      assert(_chartController.trace(otherIndex).name ==
          TraceName.values[otherIndex].toString());

      final systemIndex = TraceName.system.index;
      assert(_chartController.trace(systemIndex).name ==
          TraceName.values[systemIndex].toString());

      final totalIndex = TraceName.total.index;
      assert(_chartController.trace(totalIndex).name ==
          TraceName.values[totalIndex].toString());

      return;
    }

    // Need to create the trace first time.

    // Stack trace
    final stackIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: stackColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.stack.toString(),
    );
    assert(stackIndex == TraceName.stack.index);
    assert(_chartController.trace(stackIndex).name ==
        TraceName.values[stackIndex].toString());

    // Java heap trace.
    final javaHeapIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: javaColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.javaHeap.toString(),
    );
    assert(javaHeapIndex == TraceName.javaHeap.index);
    assert(_chartController.trace(javaHeapIndex).name ==
        TraceName.values[javaHeapIndex].toString());

    // Code trace
    final codeIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: codeColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.code.toString(),
    );
    assert(codeIndex == TraceName.code.index);
    assert(_chartController.trace(codeIndex).name ==
        TraceName.values[codeIndex].toString());

    // Graphics Trace
    final graphicIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: graphicColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.graphics.toString(),
    );
    assert(graphicIndex == TraceName.graphics.index);
    assert(_chartController.trace(graphicIndex).name ==
        TraceName.values[graphicIndex].toString());

    // Native heap trace.
    final nativeHeapIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: nativeHeapColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.nativeHeap.toString(),
    );
    assert(nativeHeapIndex == TraceName.nativeHeap.index);
    assert(_chartController.trace(nativeHeapIndex).name ==
        TraceName.values[nativeHeapIndex].toString());

    // Other trace
    final otherIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: otherColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.other.toString(),
    );
    assert(otherIndex == TraceName.other.index);
    assert(_chartController.trace(otherIndex).name ==
        TraceName.values[otherIndex].toString());

    // System trace
    final systemIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: systemColor,
        symbol: trace.ChartSymbol.disc,
        diameter: 1.5,
      ),
      stacked: true,
      name: TraceName.system.toString(),
    );
    assert(systemIndex == TraceName.system.index);
    assert(_chartController.trace(systemIndex).name ==
        TraceName.values[systemIndex].toString());

    // Total trace.
    final totalIndex = _chartController.createTrace(
      trace.ChartType.line,
      trace.PaintCharacteristics(
        color: totalColor,
        symbol: trace.ChartSymbol.dashedLine,
        strokeWidth: 2,
      ),
      name: TraceName.total.toString(),
    );
    assert(totalIndex == TraceName.total.index);
    assert(_chartController.trace(totalIndex).name ==
        TraceName.values[totalIndex].toString());

    assert(_chartController.traces.length == TraceName.values.length);
  }