nvim-flutter / nvim-flutter/flutter-tools.nvim

Snippit import is always at the bottom instead of the top

Open
#497 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
1.4k
Forks
116
Avg merge
3m
Merged PRs (30d)
1

Description

When I use the stateless widget snippit it appears like this:

class MyWidget extends StatelessWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}import 'package:flutter/material.dart';

I have to move the import to the top every time, is there a way to fix this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the stateless widget snippet in Neovim with flutter-tools.nvim and inspect the snippet-generation entry point. Trace why the Flutter/Dart import is emitted after the widget, then verify that the generated snippet places the import before the class.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, lua, neovim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.