sendNotificationViaCloud static method

Future<bool> sendNotificationViaCloud({
  1. required String token,
  2. required String title,
  3. required String body,
  4. Map<String, String>? data,
})

Calls secureOps Cloud Function to send a push notification server-side. Returns true if sent successfully, false otherwise.

Implementation

static Future<bool> sendNotificationViaCloud({
  required String token,
  required String title,
  required String body,
  Map<String, String>? data,
}) async {
  try {
    final result = await callSecureOps({
      'action': 'sendNotification',
      'token': token,
      'title': title,
      'body': body,
      'data': data ?? {},
    });
    return result['success'] == true;
  } catch (e, st) {
    NeomErrorLogger.recordError(e, st, module: 'neom_core', operation: 'sendNotificationViaCloud');
    return false;
  }
}