From 6d0c1e5d669f7adf24ca1ff9497060b8012eb0fe Mon Sep 17 00:00:00 2001
From: ShootingStarDragons <ShootingStarDragons@protonmail.com>
Date: Sun, 23 Feb 2025 13:32:37 +0900
Subject: [PATCH] feat: can directly specify the path of sdk

---
 lua/flutter-tools/executable.lua | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lua/flutter-tools/executable.lua b/lua/flutter-tools/executable.lua
index 0a79c3e..eb211c0 100644
--- a/lua/flutter-tools/executable.lua
+++ b/lua/flutter-tools/executable.lua
@@ -126,9 +126,16 @@ function M.get(callback)
     end
   end
 
+  local flutter_sdk_path = nil
+  if config.flutter_sdk_path then flutter_sdk_path = config.flutter_sdk_path end
+
   if config.flutter_path then
-    local flutter_path = fn.resolve(config.flutter_path)
-    _paths = { flutter_bin = flutter_path, flutter_sdk = _flutter_sdk_root(flutter_path) }
+    local flutter_path = config.flutter_path
+    local flutter_path_real_try = fn.resolve(flutter_path)
+    _paths = {
+      flutter_bin = flutter_path,
+      flutter_sdk = flutter_sdk_path or _flutter_sdk_root(flutter_path_real_try),
+    }
     _paths.dart_sdk = _dart_sdk_root(_paths)
     _paths.dart_bin = _flutter_sdk_dart_bin(_paths.flutter_sdk)
     return callback(_paths)