createCounter<T extends num> method

APICounter<T> createCounter<T extends num>({
  1. required String name,
  2. String? unit,
  3. String? description,
})

Creates a Counter with the given name.

A Counter is a synchronous Instrument which supports non-negative increments.

name The name of the instrument unit Optional unit of the instrument (e.g., "ms" for milliseconds) description Optional description of the instrument

Implementation

APICounter<T> createCounter<T extends num>({
  required String name,
  String? unit,
  String? description,
}) {
  if (name.isEmpty) {
    throw ArgumentError('Counter name must not be empty');
  }

  return CounterCreate.create<T>(
    name: name,
    unit: unit,
    description: description,
    meter: this,
  );
}