Приложение на флаторе, настройки
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../domain/repositories/settings_repository.dart';
|
||||
import 'settings_event.dart';
|
||||
import 'settings_state.dart';
|
||||
|
||||
class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
|
||||
final SettingsRepository _repository;
|
||||
|
||||
SettingsBloc(this._repository) : super(const SettingsState.initial()) {
|
||||
on<SettingsStarted>(_onStarted);
|
||||
on<SettingsConfigRequested>(_onConfigRequested);
|
||||
on<SettingsApiUrlChanged>(_onApiUrlChanged);
|
||||
on<SettingsApiUrlSaved>(_onApiUrlSaved);
|
||||
on<SettingsLanguageChanged>(_onLanguageChanged);
|
||||
on<SettingsRefreshConfig>(_onRefreshConfig);
|
||||
}
|
||||
|
||||
Future<void> _onStarted(SettingsStarted event, emit) async {
|
||||
emit(const SettingsState.loading());
|
||||
|
||||
final apiUrl = await _repository.getApiUrl() ?? '';
|
||||
final languageCode = await _repository.getLanguageCode() ?? 'ru';
|
||||
final configResult = await _repository.getServerConfig();
|
||||
|
||||
configResult.when(
|
||||
onSuccess: (config) {
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: apiUrl,
|
||||
serverConfig: config,
|
||||
languageCode: languageCode,
|
||||
));
|
||||
},
|
||||
onFailure: (error) {
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: apiUrl,
|
||||
serverConfig: null,
|
||||
languageCode: languageCode,
|
||||
error: 'Failed to load server config',
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onConfigRequested(SettingsConfigRequested event, emit) async {
|
||||
if (state is! SettingsLoaded) return;
|
||||
final currentState = state as SettingsLoaded;
|
||||
|
||||
emit(const SettingsState.loading());
|
||||
final configResult = await _repository.getServerConfig();
|
||||
|
||||
configResult.when(
|
||||
onSuccess: (config) {
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: currentState.apiUrl,
|
||||
serverConfig: config,
|
||||
languageCode: currentState.languageCode,
|
||||
));
|
||||
},
|
||||
onFailure: (error) {
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: currentState.apiUrl,
|
||||
serverConfig: null,
|
||||
languageCode: currentState.languageCode,
|
||||
error: 'Failed to refresh config',
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _onApiUrlChanged(SettingsApiUrlChanged event, emit) {
|
||||
if (state is! SettingsLoaded) return;
|
||||
final currentState = state as SettingsLoaded;
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: event.url,
|
||||
serverConfig: currentState.serverConfig,
|
||||
languageCode: currentState.languageCode,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> _onApiUrlSaved(SettingsApiUrlSaved event, emit) async {
|
||||
if (state is! SettingsLoaded) return;
|
||||
final currentState = state as SettingsLoaded;
|
||||
|
||||
await _repository.saveApiUrl(event.url);
|
||||
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: event.url,
|
||||
serverConfig: currentState.serverConfig,
|
||||
languageCode: currentState.languageCode,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> _onLanguageChanged(SettingsLanguageChanged event, emit) async {
|
||||
if (state is! SettingsLoaded) return;
|
||||
final currentState = state as SettingsLoaded;
|
||||
|
||||
await _repository.saveLanguageCode(event.code);
|
||||
|
||||
emit(SettingsState.loaded(
|
||||
apiUrl: currentState.apiUrl,
|
||||
serverConfig: currentState.serverConfig,
|
||||
languageCode: event.code,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> _onRefreshConfig(SettingsRefreshConfig event, emit) async {
|
||||
add(const SettingsConfigRequested());
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'settings_event.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class SettingsEvent with _$SettingsEvent {
|
||||
const factory SettingsEvent.started() = SettingsStarted;
|
||||
const factory SettingsEvent.configRequested() = SettingsConfigRequested;
|
||||
const factory SettingsEvent.apiUrlChanged(String url) = SettingsApiUrlChanged;
|
||||
const factory SettingsEvent.apiUrlSaved(String url) = SettingsApiUrlSaved;
|
||||
const factory SettingsEvent.languageChanged(String code) = SettingsLanguageChanged;
|
||||
const factory SettingsEvent.refreshConfig() = SettingsRefreshConfig;
|
||||
}
|
||||
@@ -0,0 +1,962 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// 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, unnecessary_question_mark
|
||||
|
||||
part of 'settings_event.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SettingsEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SettingsEventCopyWith<$Res> {
|
||||
factory $SettingsEventCopyWith(
|
||||
SettingsEvent value, $Res Function(SettingsEvent) then) =
|
||||
_$SettingsEventCopyWithImpl<$Res, SettingsEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SettingsEventCopyWithImpl<$Res, $Val extends SettingsEvent>
|
||||
implements $SettingsEventCopyWith<$Res> {
|
||||
_$SettingsEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsStartedImplCopyWith<$Res> {
|
||||
factory _$$SettingsStartedImplCopyWith(_$SettingsStartedImpl value,
|
||||
$Res Function(_$SettingsStartedImpl) then) =
|
||||
__$$SettingsStartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsStartedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsStartedImpl>
|
||||
implements _$$SettingsStartedImplCopyWith<$Res> {
|
||||
__$$SettingsStartedImplCopyWithImpl(
|
||||
_$SettingsStartedImpl _value, $Res Function(_$SettingsStartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsStartedImpl implements SettingsStarted {
|
||||
const _$SettingsStartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SettingsStartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsStarted implements SettingsEvent {
|
||||
const factory SettingsStarted() = _$SettingsStartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsConfigRequestedImplCopyWith<$Res> {
|
||||
factory _$$SettingsConfigRequestedImplCopyWith(
|
||||
_$SettingsConfigRequestedImpl value,
|
||||
$Res Function(_$SettingsConfigRequestedImpl) then) =
|
||||
__$$SettingsConfigRequestedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsConfigRequestedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsConfigRequestedImpl>
|
||||
implements _$$SettingsConfigRequestedImplCopyWith<$Res> {
|
||||
__$$SettingsConfigRequestedImplCopyWithImpl(
|
||||
_$SettingsConfigRequestedImpl _value,
|
||||
$Res Function(_$SettingsConfigRequestedImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsConfigRequestedImpl implements SettingsConfigRequested {
|
||||
const _$SettingsConfigRequestedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.configRequested()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsConfigRequestedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return configRequested();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return configRequested?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (configRequested != null) {
|
||||
return configRequested();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return configRequested(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return configRequested?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (configRequested != null) {
|
||||
return configRequested(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsConfigRequested implements SettingsEvent {
|
||||
const factory SettingsConfigRequested() = _$SettingsConfigRequestedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsApiUrlChangedImplCopyWith<$Res> {
|
||||
factory _$$SettingsApiUrlChangedImplCopyWith(
|
||||
_$SettingsApiUrlChangedImpl value,
|
||||
$Res Function(_$SettingsApiUrlChangedImpl) then) =
|
||||
__$$SettingsApiUrlChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String url});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsApiUrlChangedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsApiUrlChangedImpl>
|
||||
implements _$$SettingsApiUrlChangedImplCopyWith<$Res> {
|
||||
__$$SettingsApiUrlChangedImplCopyWithImpl(_$SettingsApiUrlChangedImpl _value,
|
||||
$Res Function(_$SettingsApiUrlChangedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? url = null,
|
||||
}) {
|
||||
return _then(_$SettingsApiUrlChangedImpl(
|
||||
null == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsApiUrlChangedImpl implements SettingsApiUrlChanged {
|
||||
const _$SettingsApiUrlChangedImpl(this.url);
|
||||
|
||||
@override
|
||||
final String url;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.apiUrlChanged(url: $url)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsApiUrlChangedImpl &&
|
||||
(identical(other.url, url) || other.url == url));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, url);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SettingsApiUrlChangedImplCopyWith<_$SettingsApiUrlChangedImpl>
|
||||
get copyWith => __$$SettingsApiUrlChangedImplCopyWithImpl<
|
||||
_$SettingsApiUrlChangedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return apiUrlChanged(url);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return apiUrlChanged?.call(url);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (apiUrlChanged != null) {
|
||||
return apiUrlChanged(url);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return apiUrlChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return apiUrlChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (apiUrlChanged != null) {
|
||||
return apiUrlChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsApiUrlChanged implements SettingsEvent {
|
||||
const factory SettingsApiUrlChanged(final String url) =
|
||||
_$SettingsApiUrlChangedImpl;
|
||||
|
||||
String get url;
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsApiUrlChangedImplCopyWith<_$SettingsApiUrlChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsApiUrlSavedImplCopyWith<$Res> {
|
||||
factory _$$SettingsApiUrlSavedImplCopyWith(_$SettingsApiUrlSavedImpl value,
|
||||
$Res Function(_$SettingsApiUrlSavedImpl) then) =
|
||||
__$$SettingsApiUrlSavedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String url});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsApiUrlSavedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsApiUrlSavedImpl>
|
||||
implements _$$SettingsApiUrlSavedImplCopyWith<$Res> {
|
||||
__$$SettingsApiUrlSavedImplCopyWithImpl(_$SettingsApiUrlSavedImpl _value,
|
||||
$Res Function(_$SettingsApiUrlSavedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? url = null,
|
||||
}) {
|
||||
return _then(_$SettingsApiUrlSavedImpl(
|
||||
null == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsApiUrlSavedImpl implements SettingsApiUrlSaved {
|
||||
const _$SettingsApiUrlSavedImpl(this.url);
|
||||
|
||||
@override
|
||||
final String url;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.apiUrlSaved(url: $url)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsApiUrlSavedImpl &&
|
||||
(identical(other.url, url) || other.url == url));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, url);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SettingsApiUrlSavedImplCopyWith<_$SettingsApiUrlSavedImpl> get copyWith =>
|
||||
__$$SettingsApiUrlSavedImplCopyWithImpl<_$SettingsApiUrlSavedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return apiUrlSaved(url);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return apiUrlSaved?.call(url);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (apiUrlSaved != null) {
|
||||
return apiUrlSaved(url);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return apiUrlSaved(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return apiUrlSaved?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (apiUrlSaved != null) {
|
||||
return apiUrlSaved(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsApiUrlSaved implements SettingsEvent {
|
||||
const factory SettingsApiUrlSaved(final String url) =
|
||||
_$SettingsApiUrlSavedImpl;
|
||||
|
||||
String get url;
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsApiUrlSavedImplCopyWith<_$SettingsApiUrlSavedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsLanguageChangedImplCopyWith<$Res> {
|
||||
factory _$$SettingsLanguageChangedImplCopyWith(
|
||||
_$SettingsLanguageChangedImpl value,
|
||||
$Res Function(_$SettingsLanguageChangedImpl) then) =
|
||||
__$$SettingsLanguageChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String code});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsLanguageChangedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsLanguageChangedImpl>
|
||||
implements _$$SettingsLanguageChangedImplCopyWith<$Res> {
|
||||
__$$SettingsLanguageChangedImplCopyWithImpl(
|
||||
_$SettingsLanguageChangedImpl _value,
|
||||
$Res Function(_$SettingsLanguageChangedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? code = null,
|
||||
}) {
|
||||
return _then(_$SettingsLanguageChangedImpl(
|
||||
null == code
|
||||
? _value.code
|
||||
: code // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsLanguageChangedImpl implements SettingsLanguageChanged {
|
||||
const _$SettingsLanguageChangedImpl(this.code);
|
||||
|
||||
@override
|
||||
final String code;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.languageChanged(code: $code)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsLanguageChangedImpl &&
|
||||
(identical(other.code, code) || other.code == code));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, code);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SettingsLanguageChangedImplCopyWith<_$SettingsLanguageChangedImpl>
|
||||
get copyWith => __$$SettingsLanguageChangedImplCopyWithImpl<
|
||||
_$SettingsLanguageChangedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return languageChanged(code);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return languageChanged?.call(code);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (languageChanged != null) {
|
||||
return languageChanged(code);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return languageChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return languageChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (languageChanged != null) {
|
||||
return languageChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsLanguageChanged implements SettingsEvent {
|
||||
const factory SettingsLanguageChanged(final String code) =
|
||||
_$SettingsLanguageChangedImpl;
|
||||
|
||||
String get code;
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsLanguageChangedImplCopyWith<_$SettingsLanguageChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsRefreshConfigImplCopyWith<$Res> {
|
||||
factory _$$SettingsRefreshConfigImplCopyWith(
|
||||
_$SettingsRefreshConfigImpl value,
|
||||
$Res Function(_$SettingsRefreshConfigImpl) then) =
|
||||
__$$SettingsRefreshConfigImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsRefreshConfigImplCopyWithImpl<$Res>
|
||||
extends _$SettingsEventCopyWithImpl<$Res, _$SettingsRefreshConfigImpl>
|
||||
implements _$$SettingsRefreshConfigImplCopyWith<$Res> {
|
||||
__$$SettingsRefreshConfigImplCopyWithImpl(_$SettingsRefreshConfigImpl _value,
|
||||
$Res Function(_$SettingsRefreshConfigImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsRefreshConfigImpl implements SettingsRefreshConfig {
|
||||
const _$SettingsRefreshConfigImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsEvent.refreshConfig()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsRefreshConfigImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() configRequested,
|
||||
required TResult Function(String url) apiUrlChanged,
|
||||
required TResult Function(String url) apiUrlSaved,
|
||||
required TResult Function(String code) languageChanged,
|
||||
required TResult Function() refreshConfig,
|
||||
}) {
|
||||
return refreshConfig();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? configRequested,
|
||||
TResult? Function(String url)? apiUrlChanged,
|
||||
TResult? Function(String url)? apiUrlSaved,
|
||||
TResult? Function(String code)? languageChanged,
|
||||
TResult? Function()? refreshConfig,
|
||||
}) {
|
||||
return refreshConfig?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? configRequested,
|
||||
TResult Function(String url)? apiUrlChanged,
|
||||
TResult Function(String url)? apiUrlSaved,
|
||||
TResult Function(String code)? languageChanged,
|
||||
TResult Function()? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (refreshConfig != null) {
|
||||
return refreshConfig();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsStarted value) started,
|
||||
required TResult Function(SettingsConfigRequested value) configRequested,
|
||||
required TResult Function(SettingsApiUrlChanged value) apiUrlChanged,
|
||||
required TResult Function(SettingsApiUrlSaved value) apiUrlSaved,
|
||||
required TResult Function(SettingsLanguageChanged value) languageChanged,
|
||||
required TResult Function(SettingsRefreshConfig value) refreshConfig,
|
||||
}) {
|
||||
return refreshConfig(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsStarted value)? started,
|
||||
TResult? Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult? Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult? Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult? Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult? Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
}) {
|
||||
return refreshConfig?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsStarted value)? started,
|
||||
TResult Function(SettingsConfigRequested value)? configRequested,
|
||||
TResult Function(SettingsApiUrlChanged value)? apiUrlChanged,
|
||||
TResult Function(SettingsApiUrlSaved value)? apiUrlSaved,
|
||||
TResult Function(SettingsLanguageChanged value)? languageChanged,
|
||||
TResult Function(SettingsRefreshConfig value)? refreshConfig,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (refreshConfig != null) {
|
||||
return refreshConfig(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsRefreshConfig implements SettingsEvent {
|
||||
const factory SettingsRefreshConfig() = _$SettingsRefreshConfigImpl;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import '../../domain/entities/server_config.dart';
|
||||
|
||||
part 'settings_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class SettingsState with _$SettingsState {
|
||||
const factory SettingsState.initial() = SettingsInitial;
|
||||
const factory SettingsState.loading() = SettingsLoading;
|
||||
const factory SettingsState.loaded({
|
||||
required String apiUrl,
|
||||
required ServerConfig? serverConfig,
|
||||
required String languageCode,
|
||||
String? error,
|
||||
}) = SettingsLoaded;
|
||||
const factory SettingsState.error(String message) = SettingsError;
|
||||
}
|
||||
@@ -0,0 +1,692 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// 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, unnecessary_question_mark
|
||||
|
||||
part of 'settings_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SettingsState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsInitial value) initial,
|
||||
required TResult Function(SettingsLoading value) loading,
|
||||
required TResult Function(SettingsLoaded value) loaded,
|
||||
required TResult Function(SettingsError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsInitial value)? initial,
|
||||
TResult? Function(SettingsLoading value)? loading,
|
||||
TResult? Function(SettingsLoaded value)? loaded,
|
||||
TResult? Function(SettingsError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsInitial value)? initial,
|
||||
TResult Function(SettingsLoading value)? loading,
|
||||
TResult Function(SettingsLoaded value)? loaded,
|
||||
TResult Function(SettingsError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SettingsStateCopyWith<$Res> {
|
||||
factory $SettingsStateCopyWith(
|
||||
SettingsState value, $Res Function(SettingsState) then) =
|
||||
_$SettingsStateCopyWithImpl<$Res, SettingsState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SettingsStateCopyWithImpl<$Res, $Val extends SettingsState>
|
||||
implements $SettingsStateCopyWith<$Res> {
|
||||
_$SettingsStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsInitialImplCopyWith<$Res> {
|
||||
factory _$$SettingsInitialImplCopyWith(_$SettingsInitialImpl value,
|
||||
$Res Function(_$SettingsInitialImpl) then) =
|
||||
__$$SettingsInitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsInitialImplCopyWithImpl<$Res>
|
||||
extends _$SettingsStateCopyWithImpl<$Res, _$SettingsInitialImpl>
|
||||
implements _$$SettingsInitialImplCopyWith<$Res> {
|
||||
__$$SettingsInitialImplCopyWithImpl(
|
||||
_$SettingsInitialImpl _value, $Res Function(_$SettingsInitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsInitialImpl implements SettingsInitial {
|
||||
const _$SettingsInitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SettingsInitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsInitial value) initial,
|
||||
required TResult Function(SettingsLoading value) loading,
|
||||
required TResult Function(SettingsLoaded value) loaded,
|
||||
required TResult Function(SettingsError value) error,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsInitial value)? initial,
|
||||
TResult? Function(SettingsLoading value)? loading,
|
||||
TResult? Function(SettingsLoaded value)? loaded,
|
||||
TResult? Function(SettingsError value)? error,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsInitial value)? initial,
|
||||
TResult Function(SettingsLoading value)? loading,
|
||||
TResult Function(SettingsLoaded value)? loaded,
|
||||
TResult Function(SettingsError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsInitial implements SettingsState {
|
||||
const factory SettingsInitial() = _$SettingsInitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsLoadingImplCopyWith<$Res> {
|
||||
factory _$$SettingsLoadingImplCopyWith(_$SettingsLoadingImpl value,
|
||||
$Res Function(_$SettingsLoadingImpl) then) =
|
||||
__$$SettingsLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsLoadingImplCopyWithImpl<$Res>
|
||||
extends _$SettingsStateCopyWithImpl<$Res, _$SettingsLoadingImpl>
|
||||
implements _$$SettingsLoadingImplCopyWith<$Res> {
|
||||
__$$SettingsLoadingImplCopyWithImpl(
|
||||
_$SettingsLoadingImpl _value, $Res Function(_$SettingsLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsLoadingImpl implements SettingsLoading {
|
||||
const _$SettingsLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SettingsLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsInitial value) initial,
|
||||
required TResult Function(SettingsLoading value) loading,
|
||||
required TResult Function(SettingsLoaded value) loaded,
|
||||
required TResult Function(SettingsError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsInitial value)? initial,
|
||||
TResult? Function(SettingsLoading value)? loading,
|
||||
TResult? Function(SettingsLoaded value)? loaded,
|
||||
TResult? Function(SettingsError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsInitial value)? initial,
|
||||
TResult Function(SettingsLoading value)? loading,
|
||||
TResult Function(SettingsLoaded value)? loaded,
|
||||
TResult Function(SettingsError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsLoading implements SettingsState {
|
||||
const factory SettingsLoading() = _$SettingsLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsLoadedImplCopyWith<$Res> {
|
||||
factory _$$SettingsLoadedImplCopyWith(_$SettingsLoadedImpl value,
|
||||
$Res Function(_$SettingsLoadedImpl) then) =
|
||||
__$$SettingsLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String apiUrl,
|
||||
ServerConfig? serverConfig,
|
||||
String languageCode,
|
||||
String? error});
|
||||
|
||||
$ServerConfigCopyWith<$Res>? get serverConfig;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsLoadedImplCopyWithImpl<$Res>
|
||||
extends _$SettingsStateCopyWithImpl<$Res, _$SettingsLoadedImpl>
|
||||
implements _$$SettingsLoadedImplCopyWith<$Res> {
|
||||
__$$SettingsLoadedImplCopyWithImpl(
|
||||
_$SettingsLoadedImpl _value, $Res Function(_$SettingsLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? apiUrl = null,
|
||||
Object? serverConfig = freezed,
|
||||
Object? languageCode = null,
|
||||
Object? error = freezed,
|
||||
}) {
|
||||
return _then(_$SettingsLoadedImpl(
|
||||
apiUrl: null == apiUrl
|
||||
? _value.apiUrl
|
||||
: apiUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
serverConfig: freezed == serverConfig
|
||||
? _value.serverConfig
|
||||
: serverConfig // ignore: cast_nullable_to_non_nullable
|
||||
as ServerConfig?,
|
||||
languageCode: null == languageCode
|
||||
? _value.languageCode
|
||||
: languageCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
error: freezed == error
|
||||
? _value.error
|
||||
: error // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ServerConfigCopyWith<$Res>? get serverConfig {
|
||||
if (_value.serverConfig == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ServerConfigCopyWith<$Res>(_value.serverConfig!, (value) {
|
||||
return _then(_value.copyWith(serverConfig: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsLoadedImpl implements SettingsLoaded {
|
||||
const _$SettingsLoadedImpl(
|
||||
{required this.apiUrl,
|
||||
required this.serverConfig,
|
||||
required this.languageCode,
|
||||
this.error});
|
||||
|
||||
@override
|
||||
final String apiUrl;
|
||||
@override
|
||||
final ServerConfig? serverConfig;
|
||||
@override
|
||||
final String languageCode;
|
||||
@override
|
||||
final String? error;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsState.loaded(apiUrl: $apiUrl, serverConfig: $serverConfig, languageCode: $languageCode, error: $error)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsLoadedImpl &&
|
||||
(identical(other.apiUrl, apiUrl) || other.apiUrl == apiUrl) &&
|
||||
(identical(other.serverConfig, serverConfig) ||
|
||||
other.serverConfig == serverConfig) &&
|
||||
(identical(other.languageCode, languageCode) ||
|
||||
other.languageCode == languageCode) &&
|
||||
(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, apiUrl, serverConfig, languageCode, error);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SettingsLoadedImplCopyWith<_$SettingsLoadedImpl> get copyWith =>
|
||||
__$$SettingsLoadedImplCopyWithImpl<_$SettingsLoadedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loaded(apiUrl, serverConfig, languageCode, this.error);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loaded?.call(apiUrl, serverConfig, languageCode, this.error);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(apiUrl, serverConfig, languageCode, this.error);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsInitial value) initial,
|
||||
required TResult Function(SettingsLoading value) loading,
|
||||
required TResult Function(SettingsLoaded value) loaded,
|
||||
required TResult Function(SettingsError value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsInitial value)? initial,
|
||||
TResult? Function(SettingsLoading value)? loading,
|
||||
TResult? Function(SettingsLoaded value)? loaded,
|
||||
TResult? Function(SettingsError value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsInitial value)? initial,
|
||||
TResult Function(SettingsLoading value)? loading,
|
||||
TResult Function(SettingsLoaded value)? loaded,
|
||||
TResult Function(SettingsError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsLoaded implements SettingsState {
|
||||
const factory SettingsLoaded(
|
||||
{required final String apiUrl,
|
||||
required final ServerConfig? serverConfig,
|
||||
required final String languageCode,
|
||||
final String? error}) = _$SettingsLoadedImpl;
|
||||
|
||||
String get apiUrl;
|
||||
ServerConfig? get serverConfig;
|
||||
String get languageCode;
|
||||
String? get error;
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsLoadedImplCopyWith<_$SettingsLoadedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SettingsErrorImplCopyWith<$Res> {
|
||||
factory _$$SettingsErrorImplCopyWith(
|
||||
_$SettingsErrorImpl value, $Res Function(_$SettingsErrorImpl) then) =
|
||||
__$$SettingsErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String message});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SettingsErrorImplCopyWithImpl<$Res>
|
||||
extends _$SettingsStateCopyWithImpl<$Res, _$SettingsErrorImpl>
|
||||
implements _$$SettingsErrorImplCopyWith<$Res> {
|
||||
__$$SettingsErrorImplCopyWithImpl(
|
||||
_$SettingsErrorImpl _value, $Res Function(_$SettingsErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? message = null,
|
||||
}) {
|
||||
return _then(_$SettingsErrorImpl(
|
||||
null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SettingsErrorImpl implements SettingsError {
|
||||
const _$SettingsErrorImpl(this.message);
|
||||
|
||||
@override
|
||||
final String message;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsState.error(message: $message)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsErrorImpl &&
|
||||
(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, message);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SettingsErrorImplCopyWith<_$SettingsErrorImpl> get copyWith =>
|
||||
__$$SettingsErrorImplCopyWithImpl<_$SettingsErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return error(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return error?.call(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(String apiUrl, ServerConfig? serverConfig,
|
||||
String languageCode, String? error)?
|
||||
loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(message);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(SettingsInitial value) initial,
|
||||
required TResult Function(SettingsLoading value) loading,
|
||||
required TResult Function(SettingsLoaded value) loaded,
|
||||
required TResult Function(SettingsError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(SettingsInitial value)? initial,
|
||||
TResult? Function(SettingsLoading value)? loading,
|
||||
TResult? Function(SettingsLoaded value)? loaded,
|
||||
TResult? Function(SettingsError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(SettingsInitial value)? initial,
|
||||
TResult Function(SettingsLoading value)? loading,
|
||||
TResult Function(SettingsLoaded value)? loaded,
|
||||
TResult Function(SettingsError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsError implements SettingsState {
|
||||
const factory SettingsError(final String message) = _$SettingsErrorImpl;
|
||||
|
||||
String get message;
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsErrorImplCopyWith<_$SettingsErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user