readCustomDataField function
Normaliza o customData que chega do canal nativo.
O MethodChannel entrega Map<Object?, Object?>, e valores não-string podem
aparecer, então a conversão é explícita em vez de um cast.
Implementation
Map<String, String> readCustomDataField(Object? raw) {
if (raw == null) return const {};
if (raw is Map) {
final result = <String, String>{};
raw.forEach((key, value) {
if (key == null || value == null) return;
result[key.toString()] = value.toString();
});
return Map.unmodifiable(result);
}
return DitoPushPayload.fromData({'custom_data': raw}).customData;
}