collectMetrics method

Future<void> collectMetrics()

Pumps the meter provider and forwards collected metrics to the in-memory exporter. Call this in a test after recording metrics but before asserting on metrics.

Implementation

Future<void> collectMetrics() async {
  final data = await metricReader.collect();
  await metrics.export(data);
}