1diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
2index dd80b1e46e..8e54517765 100644
3--- a/packages/flutter_tools/lib/src/cache.dart
4+++ b/packages/flutter_tools/lib/src/cache.dart
5@@ -22,6 +22,7 @@ import 'base/user_messages.dart';
6 import 'build_info.dart';
7 import 'convert.dart';
8 import 'features.dart';
9+import 'globals.dart' as globals;
10
11 const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
12 const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
13@@ -318,8 +319,13 @@ class Cache {
14 return;
15 }
16 assert(_lock == null);
17+ final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
18+ if (!dir.existsSync()) {
19+ dir.createSync(recursive: true);
20+ globals.os.chmod(dir, '755');
21+ }
22 final File lockFile =
23- _fileSystem.file(_fileSystem.path.join(flutterRoot!, 'bin', 'cache', 'lockfile'));
24+ _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'lockfile'));
25 try {
26 _lock = lockFile.openSync(mode: FileMode.write);
27 } on FileSystemException catch (e) {
28@@ -378,8 +384,7 @@ class Cache {
29
30 String get devToolsVersion {
31 if (_devToolsVersion == null) {
32- const String devToolsDirPath = 'dart-sdk/bin/resources/devtools';
33- final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false);
34+ final Directory devToolsDir = _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin/cache/dart-sdk/bin/resources/devtools'));
35 if (!devToolsDir.existsSync()) {
36 throw Exception('Could not find directory at ${devToolsDir.path}');
37 }