File tree Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ void _registerListeners() {
45
45
chrome.windows.onFocusChanged.addListener (
46
46
allowInterop ((_) async {
47
47
final currentTab = await activeTab;
48
- if (currentTab? .id != null ) {
49
- await _updateIcon (currentTab ! .id );
48
+ if (currentTab? .id case final tabId ? ) {
49
+ await _updateIcon (tabId );
50
50
}
51
51
}),
52
52
);
Original file line number Diff line number Diff line change @@ -349,11 +349,12 @@ Future<bool> _connectToDwds({
349
349
required int dartAppTabId,
350
350
required DebugInfo debugInfo,
351
351
}) async {
352
- if (debugInfo.extensionUrl == null ) {
352
+ final extensionUrl = debugInfo.extensionUrl;
353
+ if (extensionUrl == null ) {
353
354
debugWarn ('Can\' t connect to DWDS without an extension URL.' );
354
355
return false ;
355
356
}
356
- final uri = Uri .parse (debugInfo. extensionUrl! );
357
+ final uri = Uri .parse (extensionUrl);
357
358
// Start the client connection with DWDS:
358
359
final client = uri.isScheme ('ws' ) || uri.isScheme ('wss' )
359
360
? WebSocketClient (WebSocketChannel .connect (uri))
Original file line number Diff line number Diff line change @@ -131,10 +131,11 @@ Future<void> _launchDevTools(Event _) async {
131
131
}
132
132
133
133
void _copyAppId (Event _) {
134
- if (_appId == null ) return ;
134
+ final appId = _appId;
135
+ if (appId == null ) return ;
135
136
final clipboard = window.navigator.clipboard;
136
137
if (clipboard == null ) return ;
137
- clipboard.writeText (_appId ! );
138
+ clipboard.writeText (appId );
138
139
_updateElementVisibility (_copiedSuccessId, visible: true );
139
140
}
140
141
Original file line number Diff line number Diff line change @@ -115,32 +115,18 @@ void setExtensionPopup(PopupDetails details) {
115
115
}
116
116
}
117
117
118
- bool ? _isDevMode;
119
-
120
- bool get isDevMode {
121
- if (_isDevMode != null ) {
122
- return _isDevMode! ;
123
- }
118
+ final bool isDevMode = () {
124
119
final extensionManifest = chrome.runtime.getManifest ();
125
120
final extensionName = getProperty <String ?>(extensionManifest, 'name' ) ?? '' ;
126
- final isDevMode = extensionName.contains ('DEV' );
127
- _isDevMode = isDevMode;
128
- return isDevMode;
129
- }
121
+ return extensionName.contains ('DEV' );
122
+ }();
130
123
131
- bool ? _isMV3;
132
-
133
- bool get isMV3 {
134
- if (_isMV3 != null ) {
135
- return _isMV3! ;
136
- }
124
+ final bool isMV3 = () {
137
125
final extensionManifest = chrome.runtime.getManifest ();
138
126
final manifestVersion =
139
127
getProperty (extensionManifest, 'manifest_version' ) ?? 2 ;
140
- final isMV3 = manifestVersion == 3 ;
141
- _isMV3 = isMV3;
142
- return isMV3;
143
- }
128
+ return manifestVersion == 3 ;
129
+ }();
144
130
145
131
String addQueryParameters (
146
132
String uri, {
You can’t perform that action at this time.
0 commit comments