getDiagnostics method

  1. @override
Future<AiroHapticDiagnostics> getDiagnostics()
override

Fetches runtime diagnostics from the native engine.

Implementation

@override
Future<AiroHapticDiagnostics> getDiagnostics() async {
  return AiroHapticDiagnostics(
    totalTriggers: invocations.length,
    playedCount: invocations.where((i) => i.method != 'stopAll' && i.method != 'updateSettings').length,
    droppedCount: 0,
    activeBackend: capabilities.backend ?? 'fake_test_backend',
    lastTriggeredType: invocations.isNotEmpty ? invocations.last.method : null,
    lastTriggerTimestamp: invocations.isNotEmpty ? invocations.last.timestamp : null,
  );
}