DMX4001: Dart 3.13 primary constructors reported as invalid Dart
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start with the dmx build and dmx watch entry points and reproduce the failure against a .dart file containing a Dart 3.13 primary constructor. Trace how every .dart file under lib/ is parsed, then verify that primary constructors parse successfully and that an unrelated unannotated file no longer blocks annotated generation or watch runs.
Written by the indexing model from the issue text.
Description
Summary
dmx 0.3.0 reports DMX4001: input is not valid Dart on files that compile with Dart 3.13. The parser does not accept primary constructors (class const Foo(...) / class Foo(...)).
Because dmx build / dmx watch parse every .dart file under the given path (not only @dmx(...) classes), a single primary constructor anywhere in lib/ makes a project-wide generate/watch run fail.
Environment
- dmx:
0.3.0(VS Code extension bundled CLI, also used from terminal) - Dart:
3.13.0 - Flutter:
3.47.0 - OS: macOS (Apple Silicon)
Reproduction
- Create a file that is valid Dart 3.13, with no
@dmxannotation:
class const ZipAddressModel({
required final String pref,
required final String city,
required final String town,
});
- Run:
dmx build lib --insert-regions
# or
dmx watch lib
Actual
error: DMX4001: input is not valid Dart at line 2, column 13
The column points at const in class const ZipAddressModel({.
The same error appears on every primary-constructor class in the tree, for example:
error: lib/core/api/api.dart: DMX4001: input is not valid Dart at line 524, column 13
error: lib/features/wallet/schemas/zip_address_model.dart: DMX4001: input is not valid Dart at line 2, column 13
dmx watch lib still prints dmx: watching 1 path(s), but those files never get a usable parse.
dart analyze on the same files reports no issues.
Expected
- Dart 3.13 primary constructors should parse as valid input.
- Files without
@dmx(...)should not block generate/watch for annotated classes in the same tree. - Alternatively,
build/watchshould skip files they cannot (yet) parse, instead of failing the whole run.
Workaround
Point dmx at a single experimental file instead of the whole lib/ directory:
dmx build path/to/annotated_file.dart --insert-regions
dmx watch path/to/annotated_file.dart
That is not viable for a real app whose lib/ already uses primary constructors.
Notes
Related, but separate: DMX2001 requires an explicit type on fields such as final _fieldKey = GlobalKey<...>(). That is valid inferred Dart; calling out in case the parser is intentionally stricter than the language.
Happy to provide a minimal repo if useful.
- Dominant language
- Rust
- Stars
- 21
- Forks
- 0
- Avg merge
- 7m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Nimblesite/dmx
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Nimblesite/dmx#8 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
Nimblesite/dmx#2 ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100