resetHelium method
Future<void>
resetHelium(
{ - bool clearUserTraits = true,
- bool clearExperimentAllocations = false,
})
override
Implementation
@override
Future<void> resetHelium({
bool clearUserTraits = true,
bool clearExperimentAllocations = false,
}) async {
// Dismiss fallback sheet if it is displaying
if (_isFallbackSheetShowing &&
_fallbackContext != null &&
_fallbackContext!.mounted) {
Navigator.of(_fallbackContext!).pop();
}
_fallbackPaywallWidget = null;
_isFallbackSheetShowing = false;
_fallbackContext = null;
_currentEventHandlers = null;
// Reset native SDK state
try {
await methodChannel.invokeMethod<void>(
resetHeliumMethodName,
{
'clearUserTraits': clearUserTraits,
'clearHeliumEventListeners': true,
'clearExperimentAllocations': clearExperimentAllocations,
},
);
} catch (e) {
// Native reset likely completed; the async bridge response may have been
// lost (e.g. during module teardown). Dart state is cleaned up regardless.
log('[Helium] resetHelium did not receive native completion: $e');
} finally {
_isInitialized = false;
}
}