@@ -29,12 +29,13 @@ class PluginIsolate {
2929 /// directory).
3030 final String _path;
3131
32- /// The path to the 'plugin.dart' file that will be executed in an isolate.
33- final String executionPath;
32+ /// The path to the 'plugin.dart' file that will be executed in an isolate, or
33+ /// `null` if the isolate could not be started.
34+ final String ? executionPath;
3435
3536 /// The path to the '.packages' file used to control the resolution of
36- /// 'package:' URIs.
37- final String packagesPath;
37+ /// 'package:' URIs, or `null` if the isolate could not be started .
38+ final String ? packagesPath;
3839
3940 /// The object used to manage the receiving and sending of notifications.
4041 final AbstractNotificationManager _notificationManager;
@@ -79,7 +80,7 @@ class PluginIsolate {
7980 /// For example, a plugin cannot be started if there was an error with a
8081 /// previous attempt to start running it or if the plugin is not correctly
8182 /// configured.
82- bool get _canBeStarted => executionPath.isNotEmpty ;
83+ bool get _canBeStarted => executionPath != null ;
8384
8485 /// Adds the given [contextRoot] to the set of context roots being analyzed by
8586 /// this plugin.
@@ -181,8 +182,8 @@ class PluginIsolate {
181182 /// Creates and returns the channel used to communicate with the server.
182183 ServerCommunicationChannel _createChannel () {
183184 return ServerIsolateChannel .discovered (
184- Uri .file (executionPath, windows: Platform .isWindows),
185- Uri .file (packagesPath, windows: Platform .isWindows),
185+ Uri .file (executionPath! , windows: Platform .isWindows),
186+ Uri .file (packagesPath! , windows: Platform .isWindows),
186187 _instrumentationService,
187188 );
188189 }
@@ -217,7 +218,7 @@ class PluginSession {
217218 static const Duration WAIT_FOR_SHUTDOWN_DURATION = Duration (seconds: 10 );
218219
219220 /// The information about the plugin being executed.
220- final PluginIsolate _info ;
221+ final PluginIsolate _isolate ;
221222
222223 /// The completer used to signal when the plugin has stopped.
223224 Completer <void > pluginStoppedCompleter = Completer <void >();
@@ -248,7 +249,7 @@ class PluginSession {
248249 /// plugin.
249250 String ? _version;
250251
251- PluginSession (this ._info );
252+ PluginSession (this ._isolate );
252253
253254 /// The next request ID, encoded as a string.
254255 ///
@@ -264,12 +265,12 @@ class PluginSession {
264265 if (notification.event == PLUGIN_NOTIFICATION_ERROR ) {
265266 var params = PluginErrorParams .fromNotification (notification);
266267 if (params.isFatal) {
267- _info .stop ();
268+ _isolate .stop ();
268269 stop ();
269270 }
270271 }
271- _info ._notificationManager.handlePluginNotification (
272- _info .pluginId,
272+ _isolate ._notificationManager.handlePluginNotification (
273+ _isolate .pluginId,
273274 notification,
274275 );
275276 }
@@ -288,7 +289,7 @@ class PluginSession {
288289 if (error case [String message, String stackTraceString]) {
289290 var stackTrace = StackTrace .fromString (stackTraceString);
290291 var exception = PluginException (message);
291- _info .reportException (
292+ _isolate .reportException (
292293 CaughtException .withMessage (message, exception, stackTrace),
293294 );
294295 } else {
@@ -307,7 +308,7 @@ class PluginSession {
307308 if (requestData != null ) {
308309 var responseTime = DateTime .now ().millisecondsSinceEpoch;
309310 var duration = responseTime - requestData.requestTime;
310- PluginManager .recordResponseTime (_info , requestData.method, duration);
311+ PluginManager .recordResponseTime (_isolate , requestData.method, duration);
311312 var completer = requestData.completer;
312313 completer.complete (response);
313314 }
@@ -354,15 +355,15 @@ class PluginSession {
354355 if (error.code == RequestErrorCode .UNKNOWN_REQUEST ) {
355356 // The plugin doesn't support this request. It may just be using an
356357 // older version of the `analysis_server_plugin` package.
357- _info ._instrumentationService.logInfo (
358+ _isolate ._instrumentationService.logInfo (
358359 "Plugin cannot handle request '${request .method }' with parameters: "
359360 '$parameters .' ,
360361 );
361362 return ;
362363 }
363364 var stackTrace = StackTrace .fromString (error.stackTrace! );
364365 var exception = PluginException (error.message);
365- _info .reportException (
366+ _isolate .reportException (
366367 CaughtException .withMessage (error.message, exception, stackTrace),
367368 );
368369 }
@@ -382,24 +383,24 @@ class PluginSession {
382383 throw StateError ('Missing byte store path' );
383384 }
384385 if (! isCompatible) {
385- _info .reportException (
386+ _isolate .reportException (
386387 CaughtException (
387388 PluginException ('Plugin is not compatible.' ),
388389 StackTrace .current,
389390 ),
390391 );
391392 return false ;
392393 }
393- if (! _info ._canBeStarted) {
394- _info .reportException (
394+ if (! _isolate ._canBeStarted) {
395+ _isolate .reportException (
395396 CaughtException (
396397 PluginException ('Plugin cannot be started.' ),
397398 StackTrace .current,
398399 ),
399400 );
400401 return false ;
401402 }
402- channel = _info ._createChannel ();
403+ channel = _isolate ._createChannel ();
403404 // TODO(brianwilkerson): Determine if await is necessary, if so, change the
404405 // return type of `channel.listen` to `Future<void>`.
405406 await (channel! .listen (
@@ -412,7 +413,7 @@ class PluginSession {
412413 if (channel == null ) {
413414 // If there is an error when starting the isolate, the channel will invoke
414415 // `handleOnDone`, which will cause `channel` to be set to `null`.
415- _info .reportException (
416+ _isolate .reportException (
416417 CaughtException (
417418 PluginException ('Unrecorded error while starting the plugin.' ),
418419 StackTrace .current,
@@ -430,7 +431,7 @@ class PluginSession {
430431 _version = result.version;
431432 if (! isCompatible) {
432433 unawaited (sendRequest (PluginShutdownParams ()));
433- _info .reportException (
434+ _isolate .reportException (
434435 CaughtException (
435436 PluginException ('Plugin is not compatible.' ),
436437 StackTrace .current,
0 commit comments