@@ -82,7 +82,7 @@ Future<void> run(List<String> args) async {
8282 throwToolExit ('Cannot find SDK files at ${sdkRootSrc .path }' );
8383 }
8484 Directory ? coverageDirectory;
85- final String coverageDirectoryPath = argResults[_kOptionCoverageDirectory] as String ;
85+ final String ? coverageDirectoryPath = argResults[_kOptionCoverageDirectory] as String ? ;
8686 if (coverageDirectoryPath != null ) {
8787 if (! globals.fs.isDirectorySync (coverageDirectoryPath)) {
8888 throwToolExit ('Cannot find coverage directory at $coverageDirectoryPath ' );
@@ -109,7 +109,7 @@ Future<void> run(List<String> args) async {
109109
110110 Directory ? testDirectory;
111111 CoverageCollector ? collector;
112- if (argResults['coverage' ] as bool ) {
112+ if (argResults['coverage' ] as bool ? ?? false ) {
113113 // If we have a specified coverage directory then accept all libraries by
114114 // setting libraryNames to null.
115115 final Set <String >? libraryNames = coverageDirectory != null ? null :
@@ -164,7 +164,7 @@ Future<void> run(List<String> args) async {
164164 } else {
165165 globals.fs.currentDirectory = testDirectory;
166166 }
167- if (! await collector.collectCoverageData (argResults[_kOptionCoveragePath] as String , coverageDirectory: coverageDirectory)) {
167+ if (! await collector.collectCoverageData (argResults[_kOptionCoveragePath] as String ? , coverageDirectory: coverageDirectory)) {
168168 throwToolExit ('Failed to collect coverage data' );
169169 }
170170 }
0 commit comments