swift_metrics_bridge 0.1.0
swift_metrics_bridge: ^0.1.0 copied to clipboard
Flutter bridge to Apple's swift-metrics. Provides counters, floating-point counters, and timers via platform channels to iOS swift-metrics instances.
swift_metrics_bridge #
Flutter bridge to Apple's swift-metrics framework.
Platform Support #
| iOS | Android |
|---|---|
| Yes | No |
Installation #
dependencies:
swift_metrics_bridge: ^0.1.0
Usage #
import 'package:swift_metrics_bridge/swift_metrics_bridge.dart';
// Integer counter
const counter = Counter('button_taps');
await counter.increment();
await counter.increment(value: 5);
// Floating-point counter
const revenue = FloatingPointCounter('revenue');
await revenue.increment(value: 9.99);
// Timer
const timer = MetricsTimer('api_latency');
await timer.record(Duration(milliseconds: 250));
await timer.recordNanoseconds(1500);
How It Works #
Each metric instance maps to a corresponding swift-metrics type on iOS via method channels. By default, swift-metrics uses a no-op backend. To persist metrics, configure a swift-metrics backend (e.g., Scout) on the iOS side.