showReport method
Implementation
Future<void> showReport() async {
final context = navigatorKey.currentContext;
if (!_active || isPresentingUi || context == null || !_foreground) return;
if (!isDeviceApproved) {
await showDeviceRegistration();
return;
}
_flushPerformance();
_busy = true;
_generation++;
_notifyUi();
try {
final screenAtCapture = screen;
final snapshot = await _captureSnapshot();
final image = snapshot.bytes;
if (!_active || !context.mounted) return;
final metadata = Map<String, dynamic>.from(
await channel.invokeMapMethod<String, dynamic>('metadata') ?? {},
);
if (!_active || !context.mounted) return;
final frozenEvents = events;
final payload = <String, dynamic>{
'submissionId': const Uuid().v4(),
'platform': defaultTargetPlatform == TargetPlatform.iOS
? 'flutter-ios'
: 'flutter-android',
'screen': screenAtCapture,
'appVersion': config.appVersion,
'environment': config.environment,
'metadata': {
...metadata,
'sdkVersion': '0.1.3-dev.1',
'sdkElapsedMs': _clock.elapsedMilliseconds,
'captureMode': 'appSnapshot',
'captureStatus': snapshot.status,
if (snapshot.errorType != null)
'captureErrorType': snapshot.errorType,
'replayMode': _replayEnabled ? 'sampledFrames' : 'off',
'collectionMode': _recording
? (_replayEnabled ? 'diagnosticReplay' : 'diagnosticSession')
: 'reportOnly',
'performanceMode': _performanceEnabled
? 'flutterFrameTimings'
: 'off',
'diagnosticSchemaVersion': 2,
'diagnosticSessionId': _diagnostics.sessionId,
'diagnosticBufferBytes': _diagnostics.bytes,
'diagnosticWindowMs': 120000,
'diagnosticStartedAtMs': _recording ? _diagnostics.startedAtMs : null,
'diagnosticSource': 'flutter',
'diagnosticAdapterCoverage':
'explicit API available; Navigator and package:http require host opt-in; native internals unobserved',
},
'events': frozenEvents,
'frames': List<Map<String, dynamic>>.from(_frames),
'coverage': {
'recording': _recording,
'droppedEvents': _diagnostics.dropped,
'droppedFrames': _droppedFrames,
},
};
await _showSharedEditor(image, payload);
} finally {
_busy = false;
_clear();
_notifyUi();
}
}