fromEntry static method
Implementation
static SplitView? fromEntry(Map<dynamic, dynamic>? entry) {
if (entry == null || entry.isEmpty) {
return null;
}
final Map<String, String> mappedConfig = {};
entry['configs']?.entries.forEach((MapEntry<dynamic, dynamic> entry) => {
mappedConfig.addAll({entry.key.toString(): entry.value.toString()})
});
if (entry['treatments'] == null) {
entry['treatments'] = entry['treatments'] ?? [];
}
if (entry['sets'] == null) {
entry['sets'] = [];
}
return SplitView(
entry['name'],
entry['trafficType'],
entry['killed'],
(entry['treatments'] as List).map((el) => el as String).toList(),
entry['changeNumber'],
mappedConfig,
entry['defaultTreatment'] ?? '',
(entry['sets'] as List).map((el) => el as String).toList()
);
}