handleNotification method

Future<void> handleNotification(
  1. BuildContext context,
  2. N notification
)

Implementation

Future<void> handleNotification(BuildContext context, N notification) async {
  ArcaneFCMHandler? h = notificationHandlers[notification.runtimeType];

  if (h == null) {
    error(
      "No Notification Handler found for type ${notification.runtimeType}. Register handler in NotificationService",
    );
    return;
  }

  verbose(
    "Using handler: ${h.runtimeType} for notification: ${notification.runtimeType}",
  );
  try {
    await h.handle(context, notification);
  } catch (e, es) {
    error(
      "Failed to handle notification with handler: ${h.runtimeType}. Notification was ${notification.toMap()}",
    );
    error(e);
    error(es);
  }
}