Skip to content

fix(fvm/windows): append '.bat' extention to flutter path#468

Merged
sidlatau merged 1 commit intonvim-flutter:mainfrom
vaspadi:fix/fvm-windows
May 8, 2025
Merged

fix(fvm/windows): append '.bat' extention to flutter path#468
sidlatau merged 1 commit intonvim-flutter:mainfrom
vaspadi:fix/fvm-windows

Conversation

@vaspadi
Copy link
Contributor

@vaspadi vaspadi commented May 7, 2025

Problem

The plugin does not work with FVM on Windows. I tested this on two separate projects using Flutter versions 3.16.0 and 3.27.0.

When running the FlutterRun command, the following error occurs:

Error executing Lua callback:
...plenary/job.lua:406: Failed to spawn process:
command = "C:\\Users\\vasil\\fvm\\versions\\3.27.0\\bin\\flutter"
pid = "ENOENT: no such file or directory"

This happens because the plugin tries to run flutter directly, but on Windows the actual executable is flutter.bat.

Solution

If path.is_windows == true, we now append .bat to the path of the flutter binary. This fixes the issue and allows flutter-tools.nvim to work correctly with FVM on Windows.

I've been using this fix for several weeks without issues.

Environment

OS: Windows 11 Home
fvm: v3.2.1
flutter-tools.nvim: 8fa438f
Neovim: v0.10.4

Minimal Config to Reproduce

return {
  "nvim-flutter/flutter-tools.nvim",
  ft = "dart",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "mfussenegger/nvim-dap",
  },
  config = function()
    require("flutter-tools").setup({
      fvm = true
    })
  end,
}

@sidlatau
Copy link
Collaborator

sidlatau commented May 8, 2025

Thanks for the fix! I had simmilar PR ( #386 ) but was not able to test it.

@sidlatau sidlatau merged commit f33c5b2 into nvim-flutter:main May 8, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants