tryFromMap static method
Implementation
static MetricResult? tryFromMap(Map<String, dynamic> mapData) {
final key = mapData['key']?.toString();
final type = mapData['type']?.toString();
if (key == null || key.isEmpty || type == null || type.isEmpty) {
return null;
}
return MetricResult(
key: key,
type: type,
count: mapData['count']?.toInt() ?? 1,
duration: mapData['duration']?.toInt() ?? 0,
dimensions: mapData['dimensions'] as Map<String, dynamic>? ?? {},
);
}