BatteryResult { BatteryResult({ required this.level, required this.isCharging, }); final int level; final bool isCharging; // fromJson, toJson の定義 } @Serializable data class BatteryResult ( val level: Int val isCharging: Boolean ) struct BatteryResult: Codable { var level: Int var isCharging: Bool }