From 8c69964657f95049b2aa596baa882f0d08cf1f96 Mon Sep 17 00:00:00 2001 From: Marcin Wojnarowski Date: Mon, 13 Sep 2021 23:37:08 +0200 Subject: [PATCH] Regenerate gen files (#254) --- lib/stores/accounts_store.g.dart | 44 ++++++------ lib/stores/config_store.g.dart | 22 +++--- lib/util/async_store.dart | 6 +- lib/util/async_store.freezed.dart | 111 +++++++++++++++++++++++++++++- 4 files changed, 143 insertions(+), 40 deletions(-) diff --git a/lib/stores/accounts_store.g.dart b/lib/stores/accounts_store.g.dart index 0915053..c7076fd 100644 --- a/lib/stores/accounts_store.g.dart +++ b/lib/stores/accounts_store.g.dart @@ -6,23 +6,23 @@ part of 'accounts_store.dart'; // JsonSerializableGenerator // ************************************************************************** -AccountsStore _$AccountsStoreFromJson(Map json) { - return AccountsStore() - ..accounts = (json['accounts'] as Map?)?.map( - (k, e) => MapEntry( - k, - (e as Map).map( - (k, e) => - MapEntry(k, UserData.fromJson(e as Map)), - )), - ) ?? - {'lemmy.ml': {}} - ..defaultAccounts = (json['defaultAccounts'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ) ?? - {} - ..defaultAccount = json['defaultAccount'] as String?; -} +AccountsStore _$AccountsStoreFromJson(Map json) => + AccountsStore() + ..accounts = (json['accounts'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as Map).map( + (k, e) => + MapEntry(k, UserData.fromJson(e as Map)), + )), + ) ?? + {'lemmy.ml': {}} + ..defaultAccounts = + (json['defaultAccounts'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ) ?? + {} + ..defaultAccount = json['defaultAccount'] as String?; Map _$AccountsStoreToJson(AccountsStore instance) => { @@ -31,12 +31,10 @@ Map _$AccountsStoreToJson(AccountsStore instance) => 'defaultAccount': instance.defaultAccount, }; -UserData _$UserDataFromJson(Map json) { - return UserData( - jwt: Jwt.fromJson(json['jwt'] as String), - userId: json['userId'] as int, - ); -} +UserData _$UserDataFromJson(Map json) => UserData( + jwt: Jwt.fromJson(json['jwt'] as String), + userId: json['userId'] as int, + ); Map _$UserDataToJson(UserData instance) => { 'jwt': instance.jwt, diff --git a/lib/stores/config_store.g.dart b/lib/stores/config_store.g.dart index 215b72d..1f82534 100644 --- a/lib/stores/config_store.g.dart +++ b/lib/stores/config_store.g.dart @@ -6,18 +6,16 @@ part of 'config_store.dart'; // JsonSerializableGenerator // ************************************************************************** -ConfigStore _$ConfigStoreFromJson(Map json) { - return 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?); -} +ConfigStore _$ConfigStoreFromJson(Map 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?); Map _$ConfigStoreToJson(ConfigStore instance) => { diff --git a/lib/util/async_store.dart b/lib/util/async_store.dart index e6ca910..b998ac4 100644 --- a/lib/util/async_store.dart +++ b/lib/util/async_store.dart @@ -19,10 +19,8 @@ abstract class _AsyncStore with Store { bool get isLoading => asyncState is AsyncStateLoading; @computed - String? get errorTerm => asyncState.maybeWhen( - error: (errorTerm) => errorTerm, - orElse: () => null, - ); + String? get errorTerm => + asyncState.whenOrNull(error: (errorTerm) => errorTerm); /// runs some async action and reflects the progress in [asyncState]. /// If successful, the result is returned, otherwise null is returned. diff --git a/lib/util/async_store.freezed.dart b/lib/util/async_store.freezed.dart index 85424fc..4c0e836 100644 --- a/lib/util/async_store.freezed.dart +++ b/lib/util/async_store.freezed.dart @@ -1,5 +1,6 @@ +// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target part of 'async_store.dart'; @@ -51,6 +52,14 @@ mixin _$AsyncState { }) => throw _privateConstructorUsedError; @optionalTypeArgs + TResult? whenOrNull({ + TResult Function()? initial, + TResult Function(T data)? data, + TResult Function()? loading, + TResult Function(String errorTerm)? error, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs TResult maybeWhen({ TResult Function()? initial, TResult Function(T data)? data, @@ -68,6 +77,14 @@ mixin _$AsyncState { }) => throw _privateConstructorUsedError; @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(AsyncStateInitial value)? initial, + TResult Function(AsyncStateData value)? data, + TResult Function(AsyncStateLoading value)? loading, + TResult Function(AsyncStateError value)? error, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs TResult maybeMap({ TResult Function(AsyncStateInitial value)? initial, TResult Function(AsyncStateData value)? data, @@ -115,6 +132,7 @@ class _$AsyncStateInitialCopyWithImpl } /// @nodoc + class _$AsyncStateInitial with DiagnosticableTreeMixin implements AsyncStateInitial { @@ -150,6 +168,17 @@ class _$AsyncStateInitial return initial(); } + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function()? initial, + TResult Function(T data)? data, + TResult Function()? loading, + TResult Function(String errorTerm)? error, + }) { + return initial?.call(); + } + @override @optionalTypeArgs TResult maybeWhen({ @@ -176,6 +205,17 @@ class _$AsyncStateInitial return initial(this); } + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(AsyncStateInitial value)? initial, + TResult Function(AsyncStateData value)? data, + TResult Function(AsyncStateLoading value)? loading, + TResult Function(AsyncStateError value)? error, + }) { + return initial?.call(this); + } + @override @optionalTypeArgs TResult maybeMap({ @@ -229,6 +269,7 @@ class _$AsyncStateDataCopyWithImpl } /// @nodoc + class _$AsyncStateData with DiagnosticableTreeMixin implements AsyncStateData { @@ -278,6 +319,17 @@ class _$AsyncStateData return data(this.data); } + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function()? initial, + TResult Function(T data)? data, + TResult Function()? loading, + TResult Function(String errorTerm)? error, + }) { + return data?.call(this.data); + } + @override @optionalTypeArgs TResult maybeWhen({ @@ -304,6 +356,17 @@ class _$AsyncStateData return data(this); } + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(AsyncStateInitial value)? initial, + TResult Function(AsyncStateData value)? data, + TResult Function(AsyncStateLoading value)? loading, + TResult Function(AsyncStateError value)? error, + }) { + return data?.call(this); + } + @override @optionalTypeArgs TResult maybeMap({ @@ -349,6 +412,7 @@ class _$AsyncStateLoadingCopyWithImpl } /// @nodoc + class _$AsyncStateLoading with DiagnosticableTreeMixin implements AsyncStateLoading { @@ -384,6 +448,17 @@ class _$AsyncStateLoading return loading(); } + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function()? initial, + TResult Function(T data)? data, + TResult Function()? loading, + TResult Function(String errorTerm)? error, + }) { + return loading?.call(); + } + @override @optionalTypeArgs TResult maybeWhen({ @@ -410,6 +485,17 @@ class _$AsyncStateLoading return loading(this); } + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(AsyncStateInitial value)? initial, + TResult Function(AsyncStateData value)? data, + TResult Function(AsyncStateLoading value)? loading, + TResult Function(AsyncStateError value)? error, + }) { + return loading?.call(this); + } + @override @optionalTypeArgs TResult maybeMap({ @@ -463,6 +549,7 @@ class _$AsyncStateErrorCopyWithImpl } /// @nodoc + class _$AsyncStateError with DiagnosticableTreeMixin implements AsyncStateError { @@ -513,6 +600,17 @@ class _$AsyncStateError return error(errorTerm); } + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function()? initial, + TResult Function(T data)? data, + TResult Function()? loading, + TResult Function(String errorTerm)? error, + }) { + return error?.call(errorTerm); + } + @override @optionalTypeArgs TResult maybeWhen({ @@ -539,6 +637,17 @@ class _$AsyncStateError return error(this); } + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(AsyncStateInitial value)? initial, + TResult Function(AsyncStateData value)? data, + TResult Function(AsyncStateLoading value)? loading, + TResult Function(AsyncStateError value)? error, + }) { + return error?.call(this); + } + @override @optionalTypeArgs TResult maybeMap({