enum MeteringScreenLayoutFeature { extremeExposurePairs, filmPicker, equipmentProfiles, } typedef MeteringScreenLayoutConfig = Map; extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig { static MeteringScreenLayoutConfig fromJson(Map data) => { for (final f in MeteringScreenLayoutFeature.values) f: data[f.index.toString()] as bool? ?? true }; Map toJson() => map((key, value) => MapEntry(key.index.toString(), value)); }