CKNotification.builder constructor

CKNotification.builder({
  1. required String uuid,
  2. required String title,
  3. String? icon,
  4. String? body,
  5. int? badge,
  6. CKNotificationDirection? dir,
  7. bool? renotify,
  8. bool? requireInteraction,
  9. bool? silent,
  10. String? image,
  11. String? lang,
  12. VibratePattern? vibrate,
  13. int? timestamp,
  14. List<CKNotificationAction> actions = const [],
  15. Map<String, dynamic>? data,
  16. Map<String, dynamic>? metadata,
})

Create a CKNotification using a factory builder, allows constructing a JsNotification via individual properties. Allows providing a list of actions and metadata using within the CallKit plugin.

Implementation

factory CKNotification.builder({
  required String uuid,
  required String title,
  String? icon,
  String? body,
  int? badge,
  CKNotificationDirection? dir,
  bool? renotify,
  bool? requireInteraction,
  bool? silent,
  String? image,
  String? lang,
  VibratePattern? vibrate,
  int? timestamp,
  List<CKNotificationAction> actions = const [],
  Map<String, dynamic>? data,
  Map<String, dynamic>? metadata,
}) {
  final options = JSNotificationOptions(
    icon: icon,
    data: data,
    body: body,
    renotify: renotify,
    requireInteraction: requireInteraction,
    tag: uuid,
    silent: silent,
    actions: actions,
    badge: badge,
    dir: dir?.js,
    image: image,
    lang: lang,
    vibrate: vibrate,
    timestamp: timestamp,
  );
  final notification = JSNotification(title, options);
  return CKNotification(uuid, notification, metadata ?? const {});
}