hiranthaR / Json-to-Dart-Model

Json to Dart Model extension can convert JSON objects into Dart data classes. It supports pure Dart class conversion, Flutter-recommended JSON serialization using annotations, Freezed support, Effective Dart:Style, and many more features. Currently, it has more than 135,000 installs.
https://marketplace.visualstudio.com/items?itemName=hirantha.json-to-dart
MIT License
93 stars 18 forks source link

It is not generating a dart model from models.jsonc file #82

Closed iqboladahamjonov closed 2 years ago

iqboladahamjonov commented 2 years ago

Is there an existing issue for this?

Current Behavior

I am trying to build a dart model based on models.jsonc file from directory ztest, it unfortunately it won't build the file neither with hotkey ctrl + shift + alt + B, nor with command pallete build command. the error says "Nothing to generate from the tracked places". please guide me if I did something wrong.

my models.jsonc is simple as in the sample:

{
  "__className": "user_post", // <- The base class name of the object.
  "__path": "/lib/ztest/user_post", // <- override default path with a new one by adding '__path' key.
  "userId": 1,
  "id": 1, 
  "title": "Json To Dart Model", 
  "body": "Json to Dart advanced..."
}
iamarnas commented 2 years ago

@iqboladahamjonov Hi 👋

I'm sorry it does not work for you. The error message say att your default directory is empty and not json files detected, looks like you put your json files to the wrong directory. Your should put your all json files to the generated folder ./json_models or just use single file models.jsonc. And run build command ctrl + shift + alt + B

{
    "_path": "/lib/models" // This path means where data models will be generated otherwise to the default place from the settings. 
}
iamarnas commented 2 years ago

In my tests it work as expected and closing it due to not answer from the user. Reopen it if problem is still.