m3_lightmeter/lib/data/models/camera_feature.dart

14 lines
429 B
Dart
Raw Permalink Normal View History

2023-11-08 11:44:32 +00:00
enum CameraFeature {
spotMetering,
histogram,
2023-11-08 11:44:32 +00:00
}
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));
}