Regenerate gen files (#254)

This commit is contained in:
Marcin Wojnarowski 2021-09-13 23:37:08 +02:00 committed by GitHub
parent e2f9c43675
commit 8c69964657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 143 additions and 40 deletions

View File

@ -6,23 +6,23 @@ part of 'accounts_store.dart';
// JsonSerializableGenerator
// **************************************************************************
AccountsStore _$AccountsStoreFromJson(Map<String, dynamic> json) {
return AccountsStore()
..accounts = (json['accounts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
k,
(e as Map<String, dynamic>).map(
(k, e) =>
MapEntry(k, UserData.fromJson(e as Map<String, dynamic>)),
)),
) ??
{'lemmy.ml': {}}
..defaultAccounts = (json['defaultAccounts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
) ??
{}
..defaultAccount = json['defaultAccount'] as String?;
}
AccountsStore _$AccountsStoreFromJson(Map<String, dynamic> json) =>
AccountsStore()
..accounts = (json['accounts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
k,
(e as Map<String, dynamic>).map(
(k, e) =>
MapEntry(k, UserData.fromJson(e as Map<String, dynamic>)),
)),
) ??
{'lemmy.ml': {}}
..defaultAccounts =
(json['defaultAccounts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
) ??
{}
..defaultAccount = json['defaultAccount'] as String?;
Map<String, dynamic> _$AccountsStoreToJson(AccountsStore instance) =>
<String, dynamic>{
@ -31,12 +31,10 @@ Map<String, dynamic> _$AccountsStoreToJson(AccountsStore instance) =>
'defaultAccount': instance.defaultAccount,
};
UserData _$UserDataFromJson(Map<String, dynamic> json) {
return UserData(
jwt: Jwt.fromJson(json['jwt'] as String),
userId: json['userId'] as int,
);
}
UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
jwt: Jwt.fromJson(json['jwt'] as String),
userId: json['userId'] as int,
);
Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
'jwt': instance.jwt,

View File

@ -6,18 +6,16 @@ part of 'config_store.dart';
// JsonSerializableGenerator
// **************************************************************************
ConfigStore _$ConfigStoreFromJson(Map<String, dynamic> 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<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?);
Map<String, dynamic> _$ConfigStoreToJson(ConfigStore instance) =>
<String, dynamic>{

View File

@ -19,10 +19,8 @@ abstract class _AsyncStore<T> 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.

View File

@ -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<T> {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(T data)? data,
TResult Function()? loading,
TResult Function(String errorTerm)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(T data)? data,
@ -68,6 +77,14 @@ mixin _$AsyncState<T> {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
TResult Function(AsyncStateLoading<T> value)? loading,
TResult Function(AsyncStateError<T> value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
@ -115,6 +132,7 @@ class _$AsyncStateInitialCopyWithImpl<T, $Res>
}
/// @nodoc
class _$AsyncStateInitial<T>
with DiagnosticableTreeMixin
implements AsyncStateInitial<T> {
@ -150,6 +168,17 @@ class _$AsyncStateInitial<T>
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(T data)? data,
TResult Function()? loading,
TResult Function(String errorTerm)? error,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -176,6 +205,17 @@ class _$AsyncStateInitial<T>
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
TResult Function(AsyncStateLoading<T> value)? loading,
TResult Function(AsyncStateError<T> value)? error,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -229,6 +269,7 @@ class _$AsyncStateDataCopyWithImpl<T, $Res>
}
/// @nodoc
class _$AsyncStateData<T>
with DiagnosticableTreeMixin
implements AsyncStateData<T> {
@ -278,6 +319,17 @@ class _$AsyncStateData<T>
return data(this.data);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
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<TResult extends Object?>({
@ -304,6 +356,17 @@ class _$AsyncStateData<T>
return data(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
TResult Function(AsyncStateLoading<T> value)? loading,
TResult Function(AsyncStateError<T> value)? error,
}) {
return data?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -349,6 +412,7 @@ class _$AsyncStateLoadingCopyWithImpl<T, $Res>
}
/// @nodoc
class _$AsyncStateLoading<T>
with DiagnosticableTreeMixin
implements AsyncStateLoading<T> {
@ -384,6 +448,17 @@ class _$AsyncStateLoading<T>
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(T data)? data,
TResult Function()? loading,
TResult Function(String errorTerm)? error,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -410,6 +485,17 @@ class _$AsyncStateLoading<T>
return loading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
TResult Function(AsyncStateLoading<T> value)? loading,
TResult Function(AsyncStateError<T> value)? error,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -463,6 +549,7 @@ class _$AsyncStateErrorCopyWithImpl<T, $Res>
}
/// @nodoc
class _$AsyncStateError<T>
with DiagnosticableTreeMixin
implements AsyncStateError<T> {
@ -513,6 +600,17 @@ class _$AsyncStateError<T>
return error(errorTerm);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(T data)? data,
TResult Function()? loading,
TResult Function(String errorTerm)? error,
}) {
return error?.call(errorTerm);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -539,6 +637,17 @@ class _$AsyncStateError<T>
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(AsyncStateInitial<T> value)? initial,
TResult Function(AsyncStateData<T> value)? data,
TResult Function(AsyncStateLoading<T> value)? loading,
TResult Function(AsyncStateError<T> value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({