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

Error while parsing empty lists #3

Closed ElZombieIsra closed 4 years ago

ElZombieIsra commented 4 years ago

Describe the bug I get and error of type Cannot read property 'type' of undefined while trying to parse empty lists.

To Reproduce Steps to reproduce the behavior:

  1. Open VsCode
  2. Copy or select the example JSON
  3. Try to convert it to a Dart Model through any method you like
  4. VsCode shows an error window with the text before mentioned

Expected behavior The extension generates several Dart models.

Screenshots

Captura de Pantalla 2020-08-12 a la(s) 5 13 34 p m

Version v2.2.0

Json

{
    "services": [],
    "address": {
        "city": {
            "name": "New York"
        }
    }
}

Additional context The problem its not consistent with empty lists. This specific one happens when there's an empty list and a 2 level nested JSON.