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