Template.fromJson constructor
Template.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Template.fromJson(Map<String, dynamic> json) {
debugPrint('Raw JSON position: ${json['position']}');
debugPrint('Raw JSON pipPosition: ${json['pipPosition']}');
return Template(
trigger: Trigger.fromJson(json['trigger']),
content: Content.fromJson(json['content']),
id: json['_id'],
name: json['name'],
type: json['type'],
position: json['position'],
isActive: json['isActive'],
createdAt: DateTime.parse(json['createdAt']),
updatedAt: DateTime.parse(json['updatedAt']),
pipPosition: json['position'] != null // Changed from pipPosition to position
? PIPPosition.fromString(json['position'])
: null,
);
}