add method
Adds the usage details from other into this instance.
Implementation
void add(UsageDetails other) {
inputTokenCount = _addNullable(inputTokenCount, other.inputTokenCount);
outputTokenCount = _addNullable(outputTokenCount, other.outputTokenCount);
totalTokenCount = _addNullable(totalTokenCount, other.totalTokenCount);
cachedInputTokenCount =
_addNullable(cachedInputTokenCount, other.cachedInputTokenCount);
reasoningTokenCount =
_addNullable(reasoningTokenCount, other.reasoningTokenCount);
if (other.additionalCounts != null) {
additionalCounts ??= {};
for (final entry in other.additionalCounts!.entries) {
additionalCounts![entry.key] =
(additionalCounts![entry.key] ?? 0) + entry.value;
}
}
}