captureCurrentPage method
Implementation
Future<String> captureCurrentPage(TextDirection textDirection) async {
final config = _config;
final pageKey = _currentScreen;
if (config == null || pageKey == null) {
final reason = config == null
? 'SDK is not initialized'
: 'current screen is not set';
DigiaLog.log('capture refused: $reason');
return 'Capture unavailable — $reason';
}
if (!captureModeNotifier.value) {
return 'Capture unavailable — turn on Page & component capture';
}
if (_controller.activePayload != null ||
_surveyOrchestrator.state != null ||
_guideOrchestrator.state != null ||
_pipOrchestrator.state != null ||
_floaterStoryOrchestrator.state != null) {
return 'Capture unavailable — dismiss the active Digia experience first';
}
final result = await _captureSession.capture(
projectApiKey: config.apiKey,
pageKey: pageKey,
bubbleHidden: captureBubbleHiddenNotifier,
textDirection: textDirection,
profile: CaptureProfile(
includeText: captureTextNotifier.value,
includeImagesAndMedia: captureMediaNotifier.value,
includeOtherStructuralNodes: captureStructureNotifier.value,
),
onCaptured: () => captureFlashNotifier.value += 1,
);
return switch (result) {
CaptureSucceeded() => _recordSuccessfulCapture(pageKey),
CaptureRefused(:final reason) => 'Capture unavailable — $reason',
};
}