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
@dmx annotation:
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 / watch should 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.
Summary
dmx0.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 watchparse every.dartfile under the given path (not only@dmx(...)classes), a single primary constructor anywhere inlib/makes a project-wide generate/watch run fail.Environment
0.3.0(VS Code extension bundled CLI, also used from terminal)3.13.03.47.0Reproduction
@dmxannotation:dmx build lib --insert-regions # or dmx watch libActual
The column points at
constinclass const ZipAddressModel({.The same error appears on every primary-constructor class in the tree, for example:
dmx watch libstill printsdmx: watching 1 path(s), but those files never get a usable parse.dart analyzeon the same files reports no issues.Expected
@dmx(...)should not block generate/watch for annotated classes in the same tree.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:That is not viable for a real app whose
lib/already uses primary constructors.Notes
Related, but separate:
DMX2001requires an explicit type on fields such asfinal _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.