Skip to content

Commit

Permalink
Migrate sse to null safety. (#3753)
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c authored Mar 3, 2022
1 parent d3924e4 commit e2e70f2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// 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';

/// A shim that imitates the interface of SseClient from package:sse.
Expand All @@ -14,7 +12,7 @@ import 'dart:async';
class SseClient {
SseClient(String endpoint);

Stream get stream => null;
Stream? get stream => null;

StreamSink get sink => null;
StreamSink? get sink => null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

export '_fake_sse.dart'
if (dart.library.html) 'package:sse/client/sse_client.dart' show SseClient;
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/service/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Future<VmServiceWrapper> _connectWithSse(
client.stream!.asBroadcastStream() as Stream<String>;
final service = VmServiceWrapper.fromNewVmService(
stream,
client.sink.add,
client.sink!.add,
uri,
);

unawaited(client.sink.done.whenComplete(() {
unawaited(client.sink!.done.whenComplete(() {
finishedCompleter.complete();
service.dispose();
}));
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/shared/server_api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'globals.dart';
/// See `package:dds/src/devtools/client.dart`.
class DevToolsServerConnection {
DevToolsServerConnection._(this.sseClient) {
sseClient.stream.listen((msg) {
sseClient.stream!.listen((msg) {
_handleMessage(msg);
});
initFrameworkController();
Expand Down Expand Up @@ -125,7 +125,7 @@ class DevToolsServerConnection {
});
final completer = Completer<T>();
_completers[id] = completer;
sseClient.sink.add(json);
sseClient.sink!.add(json);
return completer.future;
}

Expand Down

0 comments on commit e2e70f2

Please sign in to comment.