AnalyticsQueueSnapshot constructor

AnalyticsQueueSnapshot({
  1. required int pendingCount,
  2. required int uploadedCount,
  3. required Map<String, int> droppedCounts,
})

Implementation

AnalyticsQueueSnapshot({
  required this.pendingCount,
  required this.uploadedCount,
  required Map<String, int> droppedCounts,
}) : droppedCounts = Map.unmodifiable(droppedCounts) {
  for (final (name, value) in [
    ('pendingCount', pendingCount),
    ('uploadedCount', uploadedCount),
  ]) {
    if (value < 0) throw ArgumentError.value(value, name, 'must be >= 0');
  }
  for (final entry in droppedCounts.entries) {
    if (entry.key.trim().isEmpty || entry.value < 0) {
      throw ArgumentError.value(entry, 'droppedCounts', 'invalid entry');
    }
  }
}