m3_lightmeter/lib/data/models/camera_feature.dart

13 lines
429 B
Dart

enum CameraFeature {
spotMetering,
histogram,
}
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));
}