lemmur-app-android/lib/stores/config_store.g.dart

73 lines
2.2 KiB
Dart
Raw Normal View History

2021-02-24 21:54:15 +01:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'config_store.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
2021-09-13 23:37:08 +02:00
ConfigStore _$ConfigStoreFromJson(Map<String, dynamic> json) => ConfigStore()
..theme = _$enumDecodeNullable(_$ThemeModeEnumMap, json['theme']) ??
ThemeMode.system
..amoledDarkMode = json['amoledDarkMode'] as bool? ?? false
..locale = LocaleSerde.fromJson(json['locale'] as String?)
..showAvatars = json['showAvatars'] as bool? ?? true
..showScores = json['showScores'] as bool? ?? true
..defaultSortType = _sortTypeFromJson(json['defaultSortType'] as String?)
..defaultListingType =
_postListingTypeFromJson(json['defaultListingType'] as String?);
2021-02-24 21:54:15 +01:00
Map<String, dynamic> _$ConfigStoreToJson(ConfigStore instance) =>
<String, dynamic>{
'theme': _$ThemeModeEnumMap[instance.theme],
'amoledDarkMode': instance.amoledDarkMode,
2021-02-27 17:02:55 +01:00
'locale': LocaleSerde.toJson(instance.locale),
2021-04-16 20:15:48 +02:00
'showAvatars': instance.showAvatars,
'showScores': instance.showScores,
2021-04-16 21:43:02 +02:00
'defaultSortType': instance.defaultSortType,
'defaultListingType': instance.defaultListingType,
2021-02-24 21:54:15 +01:00
};
2021-04-11 00:55:04 +02:00
K _$enumDecode<K, V>(
Map<K, V> enumValues,
Object? source, {
K? unknownValue,
2021-02-24 21:54:15 +01:00
}) {
if (source == null) {
2021-04-11 00:55:04 +02:00
throw ArgumentError(
'A value must be provided. Supported values: '
'${enumValues.values.join(', ')}',
);
2021-02-24 21:54:15 +01:00
}
2021-04-11 00:55:04 +02:00
return enumValues.entries.singleWhere(
(e) => e.value == source,
orElse: () {
if (unknownValue == null) {
throw ArgumentError(
'`$source` is not one of the supported values: '
'${enumValues.values.join(', ')}',
);
}
return MapEntry(unknownValue, enumValues.values.first);
},
).key;
2021-02-24 21:54:15 +01:00
}
2021-04-11 00:55:04 +02:00
K? _$enumDecodeNullable<K, V>(
Map<K, V> enumValues,
2021-02-24 21:54:15 +01:00
dynamic source, {
2021-04-11 00:55:04 +02:00
K? unknownValue,
2021-02-24 21:54:15 +01:00
}) {
if (source == null) {
return null;
}
2021-04-11 00:55:04 +02:00
return _$enumDecode<K, V>(enumValues, source, unknownValue: unknownValue);
2021-02-24 21:54:15 +01:00
}
const _$ThemeModeEnumMap = {
ThemeMode.system: 'system',
ThemeMode.light: 'light',
ThemeMode.dark: 'dark',
};