Introduction
Android Studio is an awesome IDE, but one of the major drawbacks is that it won't let us tweet "I use neovim, btw". Let's do what's necessary to keep that nerd cred.
LSP Configration
Mason does not natively support any dart language server protocol. However, when you install flutter, a dart lsp called dartls
is added. The trick is we need to add some configuration in our lsp-config.nvim
file.
Flutter tools
Now, we want all the capabilities that Android Studio provides us, such as auto restart
, auto start devtools
, color previews
. To enable them, we have to install akinsho/flutter-tools.nvim
. I'd recommend creating a new lua file specifically for that.
Let's call it flutter-config.lua
.
Telescope
You can even use flutter tools from Telescope
. All you need to do is add the following to your telescope config file.
require("telescope").load_extension("flutter")
Here's the entire file below.
return {
{
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>o", builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
end,
},
{
"nvim-telescope/telescope-ui-select.nvim",
config = function()
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
require("telescope").load_extension("ui-select")
require("telescope").load_extension("flutter")
end,
},
}
The Good Stuff
Conclusion
Now, you are all set for your flutter development needs. You can add more features from akinsho/flutter-tools
repository as you require them. PS - If you want to clone my Neovim setup, you can clone my dotfiles
laggedskapari/.config.
Need more help getting your Neovim setup? Check out the Typecraft course, Neovim for Newbs. It covers the basics, including how LSPs help give you a toolkit to rival any IDE.