getAggregated method

AggregatedTimedBlock getAggregated(
  1. String name
)

Returns aggregated numbers for a named block of code.

If the block in question never executed since the last reset, returns an aggregation with zero duration and count.

Implementation

AggregatedTimedBlock getAggregated(String name) {
  return aggregatedBlocks.singleWhere(
    (AggregatedTimedBlock block) => block.name == name,
    // Handle the case where there are no recorded blocks of the specified
    // type. In this case, the aggregated duration is simply zero, and so is
    // the number of occurrences (i.e. count).
    orElse: () => AggregatedTimedBlock(name: name, duration: 0, count: 0),
  );
}