From 851fa84f299e8a20b0d33670a51f6e67744ba9da Mon Sep 17 00:00:00 2001 From: Si Dao Date: Thu, 11 May 2023 10:40:38 +0700 Subject: [PATCH] Support nested dart sdk Signed-off-by: Si Dao --- lua/flutter-tools/executable.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/flutter-tools/executable.lua b/lua/flutter-tools/executable.lua index 3807a4f9..0021cd7b 100644 --- a/lua/flutter-tools/executable.lua +++ b/lua/flutter-tools/executable.lua @@ -44,7 +44,18 @@ end local function _flutter_sdk_dart_bin(flutter_sdk) -- retrieve the Dart binary from the Flutter SDK local binary_name = path.is_windows and "dart.bat" or "dart" - return path.join(flutter_sdk, "bin", binary_name) + local dart_search_paths = { + path.join(flutter_sdk, "bin", binary_name), + path.join(flutter_sdk, "bin", "cache", "dart-sdk", "bin", binary_name) + } + + for _, _path in ipairs(dart_search_paths) do + if path.exists(_path) then + return _path + end + end + + return "" end ---Get paths for flutter and dart based on the binary locations