receiveNotificationResponse method
void
receiveNotificationResponse(
- String? payload
)
Implementation
void receiveNotificationResponse(String? payload) {
if (payload != null) {
verbose("Notification Payload Received: $payload");
try {
print(jsonDecode(jsonDecode(payload)["data"]));
N n = notificationFromMap(jsonDecode(jsonDecode(payload)["data"]));
if (n.runtimeType == N) {
error(
"Received a generic ${n.runtimeType}. This should not happen. You need to define a typed subclass for the notification. It should be a subclass.",
);
}
notificationQueue.add(n);
success("Added ${n.runtimeType} to the notification handler queue.");
} catch (e, es) {
error("Failed to decode notification: $payload");
error(e);
error(es);
}
} else {
warn("Notification received without payload. Ignoring.");
}
Future.delayed(
Duration(milliseconds: 250),
() => tryHandleNotificationQueue(),
);
}