m3_lightmeter/lib/data/models/metering_screen_layout_config.dart
Vadim 5602b1ed80
ML-70 Migrate to Dart 3 + stricter lints (#71)
* updated pub version

* added lint

* --code=always_use_package_imports

* dart fixes

* format

* other lints
2023-05-11 15:30:18 +02:00

11 lines
515 B
Dart

enum MeteringScreenLayoutFeature { extremeExposurePairs, filmPicker }
typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
static MeteringScreenLayoutConfig fromJson(Map<String, dynamic> data) => data.map(
(key, value) => MapEntry(MeteringScreenLayoutFeature.values[int.parse(key)], value as bool),
);
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.index.toString(), value));
}