jonataslaw / jonataslaw/get_cli

How to generate model field to a `Map<String, dynamic>` type

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
654
Forks
193
PR merge metrics
No merged PRs in 30d

Description

I have some logs to display, all the logs will have a `data` field, but different logs may have different `data` structures, I can distinguish them by `type` field but how to mark the `data` filed so that it can be generated to a `Map`. I tried this:

```json
{
"data": {},
"id": "",
"type": ""
}
```

then `get generate model PATH_TO_LOG.json` will lead an error:

```
error_unexpected Could not format because the source could not be parsed:

line 40, column 8: Expected an identifier.

40 │ Data({});
│ ^

```

How to indicate a field that need to be generated to `Map`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.