-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.dart-cli-doctype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Summary
Currently, Dart does not support inline documentation for class fields or struct-like data models. This limits the ability to add concise, relevant documentation directly beside the field, which is especially useful for quickly understanding models or data structures.
Example (Current Behavior in Dart)
class ModelA {
final String field1; /// This doc is for field1 (❌ Not recognized)
final String field2;
}
The inline comment (///) next to field1 is not shown in IntelliSense
or on hover in editors like VS Code.
What I want (Inspired by Go)
In Go, this is possible:
type ModelA struct {
field1 string // Test <== Shown on hover in VS Code
}
Suggested Enhancement
Support inline /// or /** */ documentation next to class fields in Dart, similar to Go-style struct comments. This would help:
- Keep field definitions readable and concise
- Reduce boilerplate (no need to break lines for simple doc comments)
- Improve developer experience when viewing code in editors
Benefits
- Better IntelliSense / hover support for fields
- More natural for data models or DTOs
- Less vertical space wasted for simple field descriptions
Workaround
Right now, we are forced to write:
/// This doc is for field1
final String field1;
Thanks!
This would be a small but meaningful DX improvement for Dart/Flutter developers. 🙏
Metadata
Metadata
Assignees
Labels
P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.dart-cli-doctype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug