Skip to content

Sensitive Screens

Part of the Human Scoring use case.

Pause capture while sensitive input is on screen, such as a password, a card number or a one-time code. While paused, the SDK records nothing. The session continues, and capture picks up where it left off when you resume.

When to use it

  • A login or PIN screen is open
  • A payment form is open
  • Any screen your privacy policy says is not recorded

Prerequisites

  • The SDK is installed and initialized. See the Quick Start.

Usage

Pause and resume

import 'package:dea_sdk/dea_sdk.dart';

DeaSdk.instance?.pause();
// … sensitive screen …
DeaSdk.instance?.resume();
  • Always pair pause() with resume(). Time spent paused adds no actions, so a session left paused never becomes sufficient and its classification stays insufficient.
  • resume() does not override consent: if the user has not agreed, nothing is recorded after resuming either.
  • While paused, input your app reports with captureKey or capturePointer is dropped too, and so are custom events.

Note: pause() and resume() do not nest. One resume() restarts capture however many times pause() was called, so two parts of your app that pause on their own interfere: the first one to resume restarts capture while the other still shows sensitive content. Give pausing one owner, or count the pauses yourself and call resume() only when the count is back to zero.

Examples

Pause for as long as a screen is shown

import 'package:dea_sdk/dea_sdk.dart';
import 'package:flutter/material.dart';

class PaymentScreen extends StatefulWidget {
  const PaymentScreen({super.key});

  @override
  State<PaymentScreen> createState() => _PaymentScreenState();
}

class _PaymentScreenState extends State<PaymentScreen> {
  @override
  void initState() {
    super.initState();
    DeaSdk.instance?.pause();
  }

  @override
  void dispose() {
    DeaSdk.instance?.resume();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Payment')),
      body: const Column(children: [
        TextField(decoration: InputDecoration(labelText: 'Card number')),
        TextField(decoration: InputDecoration(labelText: 'CVC'), obscureText: true),
      ]),
    );
  }
}

Pause while a password field has focus

import 'package:dea_sdk/dea_sdk.dart';
import 'package:flutter/material.dart';

class PasswordField extends StatefulWidget {
  const PasswordField({super.key});

  @override
  State<PasswordField> createState() => _PasswordFieldState();
}

class _PasswordFieldState extends State<PasswordField> {
  final _focus = FocusNode();

  @override
  void initState() {
    super.initState();
    _focus.addListener(() {
      if (_focus.hasFocus) {
        DeaSdk.instance?.pause();
      } else {
        DeaSdk.instance?.resume();
      }
    });
  }

  @override
  void dispose() {
    if (_focus.hasFocus) DeaSdk.instance?.resume();
    _focus.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return TextField(
      focusNode: _focus,
      obscureText: true,
      decoration: const InputDecoration(labelText: 'Password'),
    );
  }
}

API

Member Returns Description
pause() void Stops recording. The session is kept
resume() void Starts recording again