KeyRecord.fromJson constructor

KeyRecord.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory KeyRecord.fromJson(Map<String, dynamic> json) {
  final best = json['b'];
  final lastAt = json['t'];
  return KeyRecord(
    bestPercent: best is num ? best.round().clamp(0, 100) : 0,
    lastAt: lastAt is num ? lastAt.round() : 0,
  );
}