MessagingPayload constructor
MessagingPayload({
- Map<
String, String> ? data, - NotificationMessagePayload? notification,
Implementation
MessagingPayload({this.data, this.notification}) {
if (data == null && notification == null) {
throw FirebaseMessagingAdminException(
MessagingClientErrorCode.invalidPayload,
'Messaging payload must contain at least one of the "data" or "notification" properties.',
);
}
if (data != null) {
for (final key in data!.keys) {
if (_blacklistedDataPayloadKeys.contains(key) ||
key.startsWith('google.')) {
throw FirebaseMessagingAdminException(
MessagingClientErrorCode.invalidPayload,
'Messaging payload contains the blacklisted "data.$key" property.',
);
}
}
}
}