diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index ea41b90fac..fc057731b1 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart @@ -285,8 +285,12 @@ class _Compiler { } Future shutdown() async { - await compiler.shutdown(); - compiler = null; + // Check for null in case this instance is shut down before the + // lazily-created compiler has been created. + if (compiler != null) { + await compiler.shutdown(); + compiler = null; + } } static Future handleTimeout(Future value, String path) {