m3_lightmeter/lib/data/models/camera_feature.dart
2025-02-17 21:03:09 +01:00

14 lines
448 B
Dart

enum CameraFeature {
spotMetering,
histogram,
showFocalLength,
}
typedef CameraFeaturesConfig = Map<CameraFeature, bool>;
extension CameraFeaturesConfigJson on CameraFeaturesConfig {
static CameraFeaturesConfig fromJson(Map<String, dynamic> data) =>
<CameraFeature, bool>{for (final f in CameraFeature.values) f: data[f.name] as bool? ?? false};
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.name, value));
}