map method
Implementation
List<Message> map(List<dynamic> input) {
return input
.where((element) => element != null && (element as Map).isNotEmpty)
.map((messageMap) => Message(
id: messageMap["id"] as String,
campaignId: messageMap["campaignId"] as String,
collapseId: messageMap["collapseId"] as String?,
title: messageMap["title"] as String,
body: messageMap["body"] as String,
imageUrl: messageMap["imageUrl"] as String?,
receivedAt: messageMap["receivedAt"] as int,
updatedAt: messageMap["updatedAt"] as int?,
expiresAt: messageMap["expiresAt"] as int?,
properties: Map<String, String>.from(messageMap["properties"]),
tags: messageMap["tags"] != null
? List<String>.from(messageMap["tags"])
: [],
actions: messageMap["actions"] != null
? mapActions(List.from(messageMap["actions"]))
: []))
.toList();
}