Remove redundant null assertions where flow analysis proves non-null

This commit is contained in:
dab246 authored and Dat H. Pham committed 2026-05-21 13:25:43 +07:00
1 parent be7c5506a6
commit 985e968c5e
3 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@ class CachingManager {
_tokenOidcCacheManager.clear(),
_authenticationInfoCacheManager.clear(),
if (PlatformInfo.isMobile && _sentryConfigurationCacheManager != null)
_sentryConfigurationCacheManager!.clearSentryConfiguration(),
_sentryConfigurationCacheManager.clearSentryConfiguration(),
], eagerError: true);
} catch (e) {
logWarning('CachingManager::clearAccountDataCached: Cannot clear account data cache: $e');
@@ -316,7 +316,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
for (var worker in obxListeners) {
worker.dispose();
}
Get.delete<SingleEmailController>(tag: _currentEmailId!.id.value);
Get.delete<SingleEmailController>(tag: _currentEmailId.id.value);
} else if (action is UnsubscribeFromThreadAction) {
if (_currentEmailId == null || action.emailId != _currentEmailId) return;
_handleUnsubscribe(action.listUnsubscribe);
@@ -325,13 +325,13 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
for (var worker in obxListeners) {
worker.dispose();
}
Get.delete<SingleEmailController>(tag: _currentEmailId!.id.value);
Get.delete<SingleEmailController>(tag: _currentEmailId.id.value);
} else if (action is OpenAttachmentListAction) {
if (_currentEmailId == null || action.emailId != _currentEmailId) {
return;
}
jumpToAttachmentList(
emailId: _currentEmailId!,
emailId: _currentEmailId,
countAttachments: action.countAttachments,
screenHeight: action.screenHeight,
isDisplayAllAttachments: action.isDisplayAllAttachments,
@@ -486,8 +486,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
}
void _getEmailContentAction(EmailId emailId) {
if (_currentEmailId != null && _threadDetailController?.cachedEmailLoaded[_currentEmailId!] != null) {
final emailLoaded = _threadDetailController!.cachedEmailLoaded[_currentEmailId!]!;
if (_currentEmailId != null && _threadDetailController?.cachedEmailLoaded[_currentEmailId] != null) {
final emailLoaded = _threadDetailController!.cachedEmailLoaded[_currentEmailId]!;
consumeState(Stream.value(Right(GetEmailContentFromThreadCacheSuccess(
htmlEmailContent: emailLoaded.htmlContent,
emailCurrent: emailLoaded.emailCurrent,
@@ -643,7 +643,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
void _jumpScrollViewToTopOfEmail() {
if (_currentEmailId == null) return;
_threadDetailController?.focusExpandedEmail(_currentEmailId!);
_threadDetailController?.focusExpandedEmail(_currentEmailId);
}
void _handleUnsubscribe(String listUnsubscribe) {
@@ -57,9 +57,9 @@ class SentryEcosystem {
Future<void> _cacheData(SentryConfig sentryConfig, SentryUser? sentryUser) async {
if (_cacheManager == null) return;
try {
await _cacheManager!.saveSentryConfiguration(sentryConfig.toSentryConfigurationCache());
await _cacheManager.saveSentryConfiguration(sentryConfig.toSentryConfigurationCache());
if (sentryUser != null) {
await _cacheManager!.saveSentryUser(sentryUser.toSentryUserCache());
await _cacheManager.saveSentryUser(sentryUser.toSentryUserCache());
}
} catch (e, st) {
logError(
@@ -68,7 +68,7 @@ class SentryEcosystem {
stackTrace: st,
);
// Clear both caches to avoid stale/inconsistent state (e.g. new config + old user PII)
await _cacheManager!.clearSentryConfiguration().catchError((_) {});
await _cacheManager.clearSentryConfiguration().catchError((_) {});
}
}