createUpDownCounter<T extends num> method

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

Creates an UpDownCounter with the given name.

An UpDownCounter is a synchronous Instrument which supports increments and decrements.

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

Implementation

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

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