create method
Future<List<QBEvent?> >
create(
- String type,
- String notificationType,
- int senderId,
- Map<
String, Object> payload, { - int? id,
- bool? active,
- String? name,
- int? pushType,
- double? date,
- int? endDate,
- String? period,
- int? occuredCount,
- List<
String> ? recipientsIds, - List<
String> ? recipientsTagsAny, - List<
String> ? recipientsTagsAll, - List<
String> ? recipientsTagsExclude,
Implementation
Future<List<QBEvent?>> create(String type, String notificationType,
int senderId, Map<String, Object> payload,
{int? id,
bool? active,
String? name,
int? pushType,
double? date,
int? endDate,
String? period,
int? occuredCount,
List<String>? recipientsIds,
List<String>? recipientsTagsAny,
List<String>? recipientsTagsAll,
List<String>? recipientsTagsExclude}) async {
Map<String, Object> data = Map();
data["type"] = type;
data["notificationType"] = notificationType;
data["senderId"] = senderId;
data["payload"] = payload;
if (id != null) {
data["id"] = id;
}
if (active != null) {
data["active"] = active;
}
if (name != null) {
data["name"] = name;
}
if (pushType != null) {
data["pushType"] = pushType;
}
if (date != null) {
data["date"] = date;
}
if (endDate != null) {
data["endDate"] = endDate;
}
if (period != null) {
data["period"] = period;
}
if (occuredCount != null) {
data["occuredCount"] = occuredCount;
}
if (recipientsIds != null) {
data["recipientsIds"] = recipientsIds;
}
if (recipientsTagsAny != null) {
data["recipientsTagsAny"] = recipientsTagsAny;
}
if (recipientsTagsAll != null) {
data["recipientsTagsAll"] = recipientsTagsAll;
}
if (recipientsTagsExclude != null) {
data["recipientsTagsExclude"] = recipientsTagsExclude;
}
List<Object?> list =
await _notificationModule.invokeMethod(CREATE_METHOD, data);
List<QBEvent?> eventsList = [];
for (final item in list) {
QBEvent? event =
QBEventMapper.mapToQBEvent(item as Map<dynamic, dynamic>);
eventsList.add(event);
}
return eventsList;
}