add static method

void add(
  1. String name,
  2. Duration duration, {
  3. String? description,
})

Adds duration to the timing name of the current request. When the same name is added again, the times are summed and counted.

It does nothing outside a request, or when the ServerTiming middleware is not on. Then it costs one zone lookup.

name is cleaned to a valid token: other characters become _. An empty name is ignored. description is shown next to the time.

Implementation

static void add(String name, Duration duration, {String? description}) {
  Object? timings = Zone.current[_key];
  if (timings is _Timings) timings.add(name, duration, description);
}