-
Notifications
You must be signed in to change notification settings - Fork 87
Migrate dwds/web directory to null safety #1648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,6 @@ | |
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| // @dart = 2.9 | ||
|
|
||
| import 'dart:async'; | ||
| import 'dart:html'; | ||
| import 'dart:js'; | ||
|
|
@@ -12,7 +10,7 @@ import 'restarter.dart'; | |
|
|
||
| class LegacyRestarter implements Restarter { | ||
| @override | ||
| Future<bool> restart({String runId}) async { | ||
| Future<bool> restart({String? runId}) async { | ||
| final dartLibrary = context['dart_library'] as JsObject; | ||
| if (runId == null) { | ||
| dartLibrary.callMethod('reload'); | ||
|
|
@@ -22,16 +20,17 @@ class LegacyRestarter implements Restarter { | |
| ]); | ||
| } | ||
| final reloadCompleter = Completer<bool>(); | ||
| StreamSubscription sub; | ||
| sub = window.onMessage.listen((event) { | ||
| final sub = window.onMessage.listen((event) { | ||
| final message = event.data; | ||
| if (message is Map && | ||
| message['type'] == 'DDC_STATE_CHANGE' && | ||
| message['state'] == 'restart_end') { | ||
| reloadCompleter.complete(true); | ||
| sub.cancel(); | ||
| } | ||
| }); | ||
| return reloadCompleter.future; | ||
| return reloadCompleter.future.then((value) { | ||
| sub.cancel(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this moved into the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the sub is not defined inside the callback to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see. Hmm, could the subscription be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it does not help unfortunately. I know this pattern is given as an example in many places but the analyzer is rejecting it currently (and I tend to agree with it, even just for safety, don't want the wrong pointer to be pinned here:) |
||
| return value; | ||
| }); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.