import 'package:json_annotation/json_annotation.dart'; import 'package:nextcloud/nextcloud.dart'; part 'nextcloud_notification.g.dart'; @JsonSerializable() class NextcloudNotification { NextcloudNotification({ required this.accountID, required this.priority, required this.type, required this.subject, }); factory NextcloudNotification.fromJson(final Map json) => _$NextcloudNotificationFromJson(json); Map toJson() => _$NextcloudNotificationToJson(this); final String accountID; final String priority; final String type; @JsonKey( fromJson: _fromJsonSubject, toJson: _toJsonSubject, ) final NotificationsPushNotificationDecryptedSubject subject; } NotificationsPushNotificationDecryptedSubject _fromJsonSubject(final Map data) => NotificationsPushNotificationDecryptedSubject.fromJson(data)!; Map? _toJsonSubject(final NotificationsPushNotificationDecryptedSubject subject) => subject.toJson();