Future<void> setMetric(Metric metric) async { final provider = MetricsApp.of(this); assert(provider != null, 'MetricsProvider is null'); if (provider != null) { provider.setMetric(metric); } }