On this page
Control when your Flutter app collects analytics and hide sensitive widgets before capture. Review screenshot content and values sent by your code separately.
Package covered: cux_analytics_sdk 0.0.27.
Initialize in a waiting state
Set needConfirmToStart: true in your single SDK initialization if collection must wait for consent. Do not call init() again when consent changes.
Control data collection
After your app obtains consent:
CuxAnalytics.resumeCollectingData();
When consent is withdrawn:
CuxAnalytics.stopCollectingData();
isCollectingData() reports the collection state. Use needConfirmToStart: false only when collection should begin immediately. Preserve your app's consent choice across launches.
Hide sensitive content
Wrap a sensitive widget or region in MaskingWidget:
import 'package:cux_analytics_sdk/masking_widget.dart';
MaskingWidget(
child: Text(accountBalance),
);
accountBalance is the value displayed by your app. Check masks after scrolling, loading new content and changing layouts. Do not assume every Flutter input is protected because another SDK automatically masks a native input type.
Masking covers screenshots, not values your code sends through events or user properties.
Verify collection and masking
Use synthetic data on Android and iOS. Check behavior before consent, after consent, after withdrawal and across app launches. Inspect available screenshots after scrolling, navigation and layout changes. Include custom inputs, overlays and reused list widgets.
Review screen names, identifiers and event parameters separately. A visual mask does not remove those values. Use the shared privacy checklist before testing with customer data.
If sensitive content appears, stop collection for the affected test, correct the configuration and repeat the journey. Follow Flutter troubleshooting if it still appears.