google / google/json_serializable.dart
Cannot populate the required constructor argument: elementInfo. It is assigned to a field not meant to be used in fromJson.
- Dominant language
- Dart
- Stars
- 1.6k
- Forks
- 461
- Avg merge
- 45m
- Merged PRs (30d)
- 1
Description
Hi,
So I guess my issue coz of some generics that I used I am wondering if there is some work around.
So in general I have a `Tree`, `TreeElement`, and `ElementInfo`
```
class DataTree implements Tree {
late TreeElement _root;
...
}
```
```
class TreeElement implements TreeNode {
T _elementInfo;
TreeElement({ required T elementInfo }) : _elementInfo = elementInfo; <-- This is line 18
```
on `dart run build_runner build --delete-conflicting-outputs `
I got the following error:
`Cannot populate the required constructor argument: elementInfo. It is assigned to a field not meant to be used in fromJson.
package:pendo_sdk/src/tree/tree_element.dart:18:3
`
Must admit I dont really understand the error, any suggestion of how I can overcome it?
Contributor guide
Assessment
This issue has not been assessed yet.