SimpleCloudNotifier/flutter/lib/models/sender_name_statistics.dart

27 lines
783 B
Dart
Raw Permalink Normal View History

2024-10-19 19:42:05 +02:00
class SenderNameStatistics {
final String name;
2024-10-20 03:22:39 +02:00
final String lastTimestamp;
final String firstTimestamp;
2024-10-19 19:42:05 +02:00
final int count;
const SenderNameStatistics({
required this.name,
2024-10-20 03:22:39 +02:00
required this.lastTimestamp,
required this.firstTimestamp,
2024-10-19 19:42:05 +02:00
required this.count,
});
factory SenderNameStatistics.fromJson(Map<String, dynamic> json) {
return SenderNameStatistics(
name: json['name'] as String,
2024-10-20 03:22:39 +02:00
lastTimestamp: json['last_timestamp'] as String,
firstTimestamp: json['first_timestamp'] as String,
2024-10-19 19:42:05 +02:00
count: json['count'] as int,
);
}
static List<SenderNameStatistics> fromJsonArray(List<dynamic> jsonArr) {
return jsonArr.map<SenderNameStatistics>((e) => SenderNameStatistics.fromJson(e as Map<String, dynamic>)).toList();
}
}