replace type of item to name and add test #96231
diff --git a/packages/flutter_tools/lib/src/commands/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart
index ba5c2db..85d490a 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_once.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart
@@ -56,7 +56,7 @@
final FileSystemEntityType type = fileSystem.typeSync(item);
if (type == FileSystemEntityType.notFound) {
- throwToolExit("'$type' does not exist");
+ throwToolExit("'$item' does not exist");
}
}
}
diff --git a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart
index 46312d5..7418a84 100644
--- a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart
+++ b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart
@@ -157,6 +157,14 @@
);
});
+ testWithoutContext('file not found', () async {
+ await runCommand(
+ arguments: <String>['analyze', '--no-pub', 'not_found.abc'],
+ exitMessageContains: "not_found.abc' does not exist",
+ exitCode: 1
+ );
+ });
+
// Analyze in the current directory - no arguments
testWithoutContext('working directory with errors', () async {
// Break the code to produce the "Avoid empty else" hint