Skip to content

Error handling

No device_shield method throws. Failures come back as values, so a check can never crash your app:

Where Failure looks like
Any check status: CheckStatus.failed, with a reason in error
A protection call ProtectionResult.failed, or unsupported on platforms without it
isScreenRecorded() null
Value Cause
Not supported on this platform The plugin isn’t available here, for example on web or desktop
Timed out after 5s The native check didn’t answer in time
CHECK_FAILED: … The native check threw. The message is the native exception’s
Any other text An unexpected platform error, passed through

A failed check means “unknown”. Don’t treat it as a clean result:

final report = await DeviceShield.check();
if (report.anyFailed) {
// Retry later, or fall back to your stricter behaviour.
}