FlareLaneNotification constructor
FlareLaneNotification(
- Map<String, dynamic> json
)
Implementation
FlareLaneNotification(Map<String, dynamic> json) {
if (json.containsKey('id')) id = json['id'] as String;
if (json.containsKey('title')) title = json['title'] as String?;
if (json.containsKey('body')) body = json['body'] as String;
if (json.containsKey('url')) url = json['url'] as String?;
if (json.containsKey('imageUrl')) imageUrl = json['imageUrl'] as String?;
// Bridge always sends `data` as a parsed Map (iOS Dictionary / Android pre-parsed via
// toHashMap). No JSON-string fallback needed in this layer.
if (json['data'] is Map) {
data = json['data'];
}
if (json['buttons'] is List) {
// `fromJson` returns null on malformed entries; filter those out so the typed list
// never contains nulls.
buttons = (json['buttons'] as List)
.whereType<Map>()
.map((m) => FlareLaneNotificationButton.fromJson(m))
.whereType<FlareLaneNotificationButton>()
.toList();
}
if (json['clickedButtonIndex'] is int) {
clickedButtonIndex = json['clickedButtonIndex'] as int;
}
if (json['clickedButton'] is Map) {
clickedButton = FlareLaneNotificationButton.fromJson(json['clickedButton'] as Map);
}
if (json['clickedUrl'] is String) {
clickedUrl = json['clickedUrl'] as String?;
}
}