How to train cursor to generate for me a data model class in very custom way? (paste a json response => generate data model)
for ex; in Flutter I have this custom data model class:
class PlanModel extends SafetyModel {
PlanModel({
this.id = 0,
this.sessionId = 0,
this.time = '',
this.title = '',
this.connect = false,
this.connectWith = const [],
});
String time = '', title = '';
int id = 0, sessionId = 0;
bool connect = false;
List<String> connectWith = [];
PlanModel.fromJson(Map<String, dynamic> json) {
id = intFromJson(json, 'id');
sessionId = intFromJson(json, 'sessionId');
time = stringFromJson(json, 'time');
title = stringFromJson(json, 'title');
connect = boolFromJson(json, 'connect');
connectWith = listFromJson(json, 'connectWith', (x) => stringFromJson(x, ''));
super.fromJson(json);
}
@override
Map<String, dynamic> toJson() => <String, dynamic>{
'id': id,
'sessionId': sessionId,
'time': time,
'title': title,
'connect': connect,
'connectWith': connectWith.toList(),
};
}