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.
{
"NoSalesReasons": [
{
"MainReason": "PRODUCT RELATED ISSUE",
"ChildStatement": "Which out of following best describes the reason for product related issue ?",
"ChildReasonChoices": [
"Product Complaint",
"Low Shelf Offtake",
"Expiry Issue"
]
}
]
}
Nested Array such as in ChildReasonChoices are not generated properly. Instead of List<String> data type of ChildReasonChoices, List<ChildReasonChoices> data type is generated, causing errors.
This PR attempts to fix nested array by commenting out a line in helper.ts. l.push(v); causes incorrect data type of the element inserted which makes array [ String, String,String, [String, String,String ] ]thereby making mergeableListType function to return incorrect data type (ie of the last element inserted which is array)
Nested Array such as in ChildReasonChoices are not generated properly. Instead of
List<String>
data type of ChildReasonChoices,List<ChildReasonChoices>
data type is generated, causing errors.This PR attempts to fix nested array by commenting out a line in
helper.ts
.l.push(v);
causes incorrect data type of the element inserted which makes array[ String, String,String, [String, String,String ] ]
thereby makingmergeableListType
function to return incorrect data type (ie of the last element inserted which is array)