chore: update flutter and dependencies

This commit is contained in:
Dr.Blank 2026-01-10 16:46:06 +05:30
parent 06694f5f0b
commit a520136e01
No known key found for this signature in database
GPG key ID: BA5F87FF0560C57B
80 changed files with 7701 additions and 9141 deletions

View file

@ -11,7 +11,7 @@ part 'api_settings.g.dart';
///
/// all settings that are needed to interact with the server are stored here
@freezed
class ApiSettings with _$ApiSettings {
sealed class ApiSettings with _$ApiSettings {
const factory ApiSettings({
AudiobookShelfServer? activeServer,
AuthenticatedUser? activeUser,

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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
@ -9,238 +9,317 @@ part of 'api_settings.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
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');
ApiSettings _$ApiSettingsFromJson(Map<String, dynamic> json) {
return _ApiSettings.fromJson(json);
}
/// @nodoc
mixin _$ApiSettings {
AudiobookShelfServer? get activeServer => throw _privateConstructorUsedError;
AuthenticatedUser? get activeUser => throw _privateConstructorUsedError;
String? get activeLibraryId => throw _privateConstructorUsedError;
AudiobookShelfServer? get activeServer; AuthenticatedUser? get activeUser; String? get activeLibraryId;
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ApiSettingsCopyWith<ApiSettings> get copyWith => _$ApiSettingsCopyWithImpl<ApiSettings>(this as ApiSettings, _$identity);
/// Serializes this ApiSettings to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApiSettings&&(identical(other.activeServer, activeServer) || other.activeServer == activeServer)&&(identical(other.activeUser, activeUser) || other.activeUser == activeUser)&&(identical(other.activeLibraryId, activeLibraryId) || other.activeLibraryId == activeLibraryId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,activeServer,activeUser,activeLibraryId);
@override
String toString() {
return 'ApiSettings(activeServer: $activeServer, activeUser: $activeUser, activeLibraryId: $activeLibraryId)';
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ApiSettingsCopyWith<ApiSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ApiSettingsCopyWith<$Res> {
factory $ApiSettingsCopyWith(
ApiSettings value, $Res Function(ApiSettings) then) =
_$ApiSettingsCopyWithImpl<$Res, ApiSettings>;
@useResult
$Res call(
{AudiobookShelfServer? activeServer,
AuthenticatedUser? activeUser,
String? activeLibraryId});
abstract mixin class $ApiSettingsCopyWith<$Res> {
factory $ApiSettingsCopyWith(ApiSettings value, $Res Function(ApiSettings) _then) = _$ApiSettingsCopyWithImpl;
@useResult
$Res call({
AudiobookShelfServer? activeServer, AuthenticatedUser? activeUser, String? activeLibraryId
});
$AudiobookShelfServerCopyWith<$Res>? get activeServer;$AuthenticatedUserCopyWith<$Res>? get activeUser;
$AudiobookShelfServerCopyWith<$Res>? get activeServer;
$AuthenticatedUserCopyWith<$Res>? get activeUser;
}
/// @nodoc
class _$ApiSettingsCopyWithImpl<$Res, $Val extends ApiSettings>
class _$ApiSettingsCopyWithImpl<$Res>
implements $ApiSettingsCopyWith<$Res> {
_$ApiSettingsCopyWithImpl(this._value, this._then);
_$ApiSettingsCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final ApiSettings _self;
final $Res Function(ApiSettings) _then;
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? activeServer = freezed,
Object? activeUser = freezed,
Object? activeLibraryId = freezed,
}) {
return _then(_value.copyWith(
activeServer: freezed == activeServer
? _value.activeServer
: activeServer // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer?,
activeUser: freezed == activeUser
? _value.activeUser
: activeUser // ignore: cast_nullable_to_non_nullable
as AuthenticatedUser?,
activeLibraryId: freezed == activeLibraryId
? _value.activeLibraryId
: activeLibraryId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? activeServer = freezed,Object? activeUser = freezed,Object? activeLibraryId = freezed,}) {
return _then(_self.copyWith(
activeServer: freezed == activeServer ? _self.activeServer : activeServer // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer?,activeUser: freezed == activeUser ? _self.activeUser : activeUser // ignore: cast_nullable_to_non_nullable
as AuthenticatedUser?,activeLibraryId: freezed == activeLibraryId ? _self.activeLibraryId : activeLibraryId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res>? get activeServer {
if (_self.activeServer == null) {
return null;
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res>? get activeServer {
if (_value.activeServer == null) {
return null;
}
return $AudiobookShelfServerCopyWith<$Res>(_value.activeServer!, (value) {
return _then(_value.copyWith(activeServer: value) as $Val);
});
return $AudiobookShelfServerCopyWith<$Res>(_self.activeServer!, (value) {
return _then(_self.copyWith(activeServer: value));
});
}/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthenticatedUserCopyWith<$Res>? get activeUser {
if (_self.activeUser == null) {
return null;
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthenticatedUserCopyWith<$Res>? get activeUser {
if (_value.activeUser == null) {
return null;
}
return $AuthenticatedUserCopyWith<$Res>(_value.activeUser!, (value) {
return _then(_value.copyWith(activeUser: value) as $Val);
});
}
return $AuthenticatedUserCopyWith<$Res>(_self.activeUser!, (value) {
return _then(_self.copyWith(activeUser: value));
});
}
}
/// @nodoc
abstract class _$$ApiSettingsImplCopyWith<$Res>
implements $ApiSettingsCopyWith<$Res> {
factory _$$ApiSettingsImplCopyWith(
_$ApiSettingsImpl value, $Res Function(_$ApiSettingsImpl) then) =
__$$ApiSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{AudiobookShelfServer? activeServer,
AuthenticatedUser? activeUser,
String? activeLibraryId});
@override
$AudiobookShelfServerCopyWith<$Res>? get activeServer;
@override
$AuthenticatedUserCopyWith<$Res>? get activeUser;
/// Adds pattern-matching-related methods to [ApiSettings].
extension ApiSettingsPatterns on ApiSettings {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ApiSettings value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ApiSettings() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ApiSettings value) $default,){
final _that = this;
switch (_that) {
case _ApiSettings():
return $default(_that);}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ApiSettings value)? $default,){
final _that = this;
switch (_that) {
case _ApiSettings() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( AudiobookShelfServer? activeServer, AuthenticatedUser? activeUser, String? activeLibraryId)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ApiSettings() when $default != null:
return $default(_that.activeServer,_that.activeUser,_that.activeLibraryId);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( AudiobookShelfServer? activeServer, AuthenticatedUser? activeUser, String? activeLibraryId) $default,) {final _that = this;
switch (_that) {
case _ApiSettings():
return $default(_that.activeServer,_that.activeUser,_that.activeLibraryId);}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( AudiobookShelfServer? activeServer, AuthenticatedUser? activeUser, String? activeLibraryId)? $default,) {final _that = this;
switch (_that) {
case _ApiSettings() when $default != null:
return $default(_that.activeServer,_that.activeUser,_that.activeLibraryId);case _:
return null;
}
}
/// @nodoc
class __$$ApiSettingsImplCopyWithImpl<$Res>
extends _$ApiSettingsCopyWithImpl<$Res, _$ApiSettingsImpl>
implements _$$ApiSettingsImplCopyWith<$Res> {
__$$ApiSettingsImplCopyWithImpl(
_$ApiSettingsImpl _value, $Res Function(_$ApiSettingsImpl) _then)
: super(_value, _then);
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? activeServer = freezed,
Object? activeUser = freezed,
Object? activeLibraryId = freezed,
}) {
return _then(_$ApiSettingsImpl(
activeServer: freezed == activeServer
? _value.activeServer
: activeServer // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer?,
activeUser: freezed == activeUser
? _value.activeUser
: activeUser // ignore: cast_nullable_to_non_nullable
as AuthenticatedUser?,
activeLibraryId: freezed == activeLibraryId
? _value.activeLibraryId
: activeLibraryId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ApiSettingsImpl implements _ApiSettings {
const _$ApiSettingsImpl(
{this.activeServer, this.activeUser, this.activeLibraryId});
factory _$ApiSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$ApiSettingsImplFromJson(json);
class _ApiSettings implements ApiSettings {
const _ApiSettings({this.activeServer, this.activeUser, this.activeLibraryId});
factory _ApiSettings.fromJson(Map<String, dynamic> json) => _$ApiSettingsFromJson(json);
@override
final AudiobookShelfServer? activeServer;
@override
final AuthenticatedUser? activeUser;
@override
final String? activeLibraryId;
@override final AudiobookShelfServer? activeServer;
@override final AuthenticatedUser? activeUser;
@override final String? activeLibraryId;
@override
String toString() {
return 'ApiSettings(activeServer: $activeServer, activeUser: $activeUser, activeLibraryId: $activeLibraryId)';
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ApiSettingsCopyWith<_ApiSettings> get copyWith => __$ApiSettingsCopyWithImpl<_ApiSettings>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ApiSettingsImpl &&
(identical(other.activeServer, activeServer) ||
other.activeServer == activeServer) &&
(identical(other.activeUser, activeUser) ||
other.activeUser == activeUser) &&
(identical(other.activeLibraryId, activeLibraryId) ||
other.activeLibraryId == activeLibraryId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, activeServer, activeUser, activeLibraryId);
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ApiSettingsImplCopyWith<_$ApiSettingsImpl> get copyWith =>
__$$ApiSettingsImplCopyWithImpl<_$ApiSettingsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ApiSettingsImplToJson(
this,
);
}
@override
Map<String, dynamic> toJson() {
return _$ApiSettingsToJson(this, );
}
abstract class _ApiSettings implements ApiSettings {
const factory _ApiSettings(
{final AudiobookShelfServer? activeServer,
final AuthenticatedUser? activeUser,
final String? activeLibraryId}) = _$ApiSettingsImpl;
factory _ApiSettings.fromJson(Map<String, dynamic> json) =
_$ApiSettingsImpl.fromJson;
@override
AudiobookShelfServer? get activeServer;
@override
AuthenticatedUser? get activeUser;
@override
String? get activeLibraryId;
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ApiSettingsImplCopyWith<_$ApiSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApiSettings&&(identical(other.activeServer, activeServer) || other.activeServer == activeServer)&&(identical(other.activeUser, activeUser) || other.activeUser == activeUser)&&(identical(other.activeLibraryId, activeLibraryId) || other.activeLibraryId == activeLibraryId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,activeServer,activeUser,activeLibraryId);
@override
String toString() {
return 'ApiSettings(activeServer: $activeServer, activeUser: $activeUser, activeLibraryId: $activeLibraryId)';
}
}
/// @nodoc
abstract mixin class _$ApiSettingsCopyWith<$Res> implements $ApiSettingsCopyWith<$Res> {
factory _$ApiSettingsCopyWith(_ApiSettings value, $Res Function(_ApiSettings) _then) = __$ApiSettingsCopyWithImpl;
@override @useResult
$Res call({
AudiobookShelfServer? activeServer, AuthenticatedUser? activeUser, String? activeLibraryId
});
@override $AudiobookShelfServerCopyWith<$Res>? get activeServer;@override $AuthenticatedUserCopyWith<$Res>? get activeUser;
}
/// @nodoc
class __$ApiSettingsCopyWithImpl<$Res>
implements _$ApiSettingsCopyWith<$Res> {
__$ApiSettingsCopyWithImpl(this._self, this._then);
final _ApiSettings _self;
final $Res Function(_ApiSettings) _then;
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? activeServer = freezed,Object? activeUser = freezed,Object? activeLibraryId = freezed,}) {
return _then(_ApiSettings(
activeServer: freezed == activeServer ? _self.activeServer : activeServer // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer?,activeUser: freezed == activeUser ? _self.activeUser : activeUser // ignore: cast_nullable_to_non_nullable
as AuthenticatedUser?,activeLibraryId: freezed == activeLibraryId ? _self.activeLibraryId : activeLibraryId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res>? get activeServer {
if (_self.activeServer == null) {
return null;
}
return $AudiobookShelfServerCopyWith<$Res>(_self.activeServer!, (value) {
return _then(_self.copyWith(activeServer: value));
});
}/// Create a copy of ApiSettings
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthenticatedUserCopyWith<$Res>? get activeUser {
if (_self.activeUser == null) {
return null;
}
return $AuthenticatedUserCopyWith<$Res>(_self.activeUser!, (value) {
return _then(_self.copyWith(activeUser: value));
});
}
}
// dart format on

View file

@ -6,20 +6,19 @@ part of 'api_settings.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ApiSettingsImpl _$$ApiSettingsImplFromJson(Map<String, dynamic> json) =>
_$ApiSettingsImpl(
activeServer: json['activeServer'] == null
? null
: AudiobookShelfServer.fromJson(
json['activeServer'] as Map<String, dynamic>),
activeUser: json['activeUser'] == null
? null
: AuthenticatedUser.fromJson(
json['activeUser'] as Map<String, dynamic>),
activeLibraryId: json['activeLibraryId'] as String?,
);
_ApiSettings _$ApiSettingsFromJson(Map<String, dynamic> json) => _ApiSettings(
activeServer: json['activeServer'] == null
? null
: AudiobookShelfServer.fromJson(
json['activeServer'] as Map<String, dynamic>,
),
activeUser: json['activeUser'] == null
? null
: AuthenticatedUser.fromJson(json['activeUser'] as Map<String, dynamic>),
activeLibraryId: json['activeLibraryId'] as String?,
);
Map<String, dynamic> _$$ApiSettingsImplToJson(_$ApiSettingsImpl instance) =>
Map<String, dynamic> _$ApiSettingsToJson(_ApiSettings instance) =>
<String, dynamic>{
'activeServer': instance.activeServer,
'activeUser': instance.activeUser,

View file

@ -10,7 +10,7 @@ part 'app_settings.g.dart';
///
/// only the visual settings are stored here
@freezed
class AppSettings with _$AppSettings {
sealed class AppSettings with _$AppSettings {
const factory AppSettings({
@Default(ThemeSettings()) ThemeSettings themeSettings,
@Default(PlayerSettings()) PlayerSettings playerSettings,
@ -27,7 +27,7 @@ class AppSettings with _$AppSettings {
}
@freezed
class ThemeSettings with _$ThemeSettings {
sealed class ThemeSettings with _$ThemeSettings {
const factory ThemeSettings({
@Default(ThemeMode.system) ThemeMode themeMode,
@Default(false) bool highContrast,
@ -42,7 +42,7 @@ class ThemeSettings with _$ThemeSettings {
}
@freezed
class PlayerSettings with _$PlayerSettings {
sealed class PlayerSettings with _$PlayerSettings {
const factory PlayerSettings({
@Default(MinimizedPlayerSettings())
MinimizedPlayerSettings miniPlayerSettings,
@ -65,7 +65,7 @@ class PlayerSettings with _$PlayerSettings {
}
@freezed
class ExpandedPlayerSettings with _$ExpandedPlayerSettings {
sealed class ExpandedPlayerSettings with _$ExpandedPlayerSettings {
const factory ExpandedPlayerSettings({
@Default(false) bool showTotalProgress,
@Default(true) bool showChapterProgress,
@ -76,28 +76,25 @@ class ExpandedPlayerSettings with _$ExpandedPlayerSettings {
}
@freezed
class MinimizedPlayerSettings with _$MinimizedPlayerSettings {
const factory MinimizedPlayerSettings({
@Default(false) bool useChapterInfo,
}) = _MinimizedPlayerSettings;
sealed class MinimizedPlayerSettings with _$MinimizedPlayerSettings {
const factory MinimizedPlayerSettings({@Default(false) bool useChapterInfo}) =
_MinimizedPlayerSettings;
factory MinimizedPlayerSettings.fromJson(Map<String, dynamic> json) =>
_$MinimizedPlayerSettingsFromJson(json);
}
@freezed
class SleepTimerSettings with _$SleepTimerSettings {
sealed class SleepTimerSettings with _$SleepTimerSettings {
const factory SleepTimerSettings({
@Default(Duration(minutes: 15)) Duration defaultDuration,
@Default(
[
Duration(minutes: 5),
Duration(minutes: 10),
Duration(minutes: 15),
Duration(minutes: 20),
Duration(minutes: 30),
],
)
@Default([
Duration(minutes: 5),
Duration(minutes: 10),
Duration(minutes: 15),
Duration(minutes: 20),
Duration(minutes: 30),
])
List<Duration> presetDurations,
@Default(Duration(minutes: 100)) Duration maxDuration,
@Default(false) bool fadeOutAudio,
@ -134,7 +131,7 @@ class SleepTimerSettings with _$SleepTimerSettings {
}
@freezed
class DownloadSettings with _$DownloadSettings {
sealed class DownloadSettings with _$DownloadSettings {
const factory DownloadSettings({
@Default(true) bool requiresWiFi,
@Default(3) int retries,
@ -149,21 +146,19 @@ class DownloadSettings with _$DownloadSettings {
}
@freezed
class NotificationSettings with _$NotificationSettings {
sealed class NotificationSettings with _$NotificationSettings {
const factory NotificationSettings({
@Default(Duration(seconds: 30)) Duration fastForwardInterval,
@Default(Duration(seconds: 10)) Duration rewindInterval,
@Default(true) bool progressBarIsChapterProgress,
@Default('\$bookTitle') String primaryTitle,
@Default('\$author') String secondaryTitle,
@Default(
[
NotificationMediaControl.rewind,
NotificationMediaControl.fastForward,
NotificationMediaControl.skipToPreviousChapter,
NotificationMediaControl.skipToNextChapter,
],
)
@Default([
NotificationMediaControl.rewind,
NotificationMediaControl.fastForward,
NotificationMediaControl.skipToPreviousChapter,
NotificationMediaControl.skipToNextChapter,
])
List<NotificationMediaControl> mediaControls,
}) = _NotificationSettings;
@ -196,7 +191,7 @@ enum NotificationMediaControl {
/// Shake Detection Settings
@freezed
class ShakeDetectionSettings with _$ShakeDetectionSettings {
sealed class ShakeDetectionSettings with _$ShakeDetectionSettings {
const factory ShakeDetectionSettings({
@Default(true) bool isEnabled,
@Default(ShakeDirection.horizontal) ShakeDirection direction,
@ -222,18 +217,12 @@ class ShakeDetectionSettings with _$ShakeDetectionSettings {
enum ShakeDirection { horizontal, vertical }
enum ShakeAction {
none,
playPause,
resetSleepTimer,
fastForward,
rewind,
}
enum ShakeAction { none, playPause, resetSleepTimer, fastForward, rewind }
enum ShakeDetectedFeedback { vibrate, beep }
@freezed
class HomePageSettings with _$HomePageSettings {
sealed class HomePageSettings with _$HomePageSettings {
const factory HomePageSettings({
@Default(true) bool showPlayButtonOnContinueListeningShelf,
@Default(false) bool showPlayButtonOnContinueSeriesShelf,

File diff suppressed because it is too large Load diff

View file

@ -6,39 +6,41 @@ part of 'app_settings.dart';
// JsonSerializableGenerator
// **************************************************************************
_$AppSettingsImpl _$$AppSettingsImplFromJson(Map<String, dynamic> json) =>
_$AppSettingsImpl(
themeSettings: json['themeSettings'] == null
? const ThemeSettings()
: ThemeSettings.fromJson(
json['themeSettings'] as Map<String, dynamic>),
playerSettings: json['playerSettings'] == null
? const PlayerSettings()
: PlayerSettings.fromJson(
json['playerSettings'] as Map<String, dynamic>),
sleepTimerSettings: json['sleepTimerSettings'] == null
? const SleepTimerSettings()
: SleepTimerSettings.fromJson(
json['sleepTimerSettings'] as Map<String, dynamic>),
downloadSettings: json['downloadSettings'] == null
? const DownloadSettings()
: DownloadSettings.fromJson(
json['downloadSettings'] as Map<String, dynamic>),
notificationSettings: json['notificationSettings'] == null
? const NotificationSettings()
: NotificationSettings.fromJson(
json['notificationSettings'] as Map<String, dynamic>),
shakeDetectionSettings: json['shakeDetectionSettings'] == null
? const ShakeDetectionSettings()
: ShakeDetectionSettings.fromJson(
json['shakeDetectionSettings'] as Map<String, dynamic>),
homePageSettings: json['homePageSettings'] == null
? const HomePageSettings()
: HomePageSettings.fromJson(
json['homePageSettings'] as Map<String, dynamic>),
);
_AppSettings _$AppSettingsFromJson(Map<String, dynamic> json) => _AppSettings(
themeSettings: json['themeSettings'] == null
? const ThemeSettings()
: ThemeSettings.fromJson(json['themeSettings'] as Map<String, dynamic>),
playerSettings: json['playerSettings'] == null
? const PlayerSettings()
: PlayerSettings.fromJson(json['playerSettings'] as Map<String, dynamic>),
sleepTimerSettings: json['sleepTimerSettings'] == null
? const SleepTimerSettings()
: SleepTimerSettings.fromJson(
json['sleepTimerSettings'] as Map<String, dynamic>,
),
downloadSettings: json['downloadSettings'] == null
? const DownloadSettings()
: DownloadSettings.fromJson(
json['downloadSettings'] as Map<String, dynamic>,
),
notificationSettings: json['notificationSettings'] == null
? const NotificationSettings()
: NotificationSettings.fromJson(
json['notificationSettings'] as Map<String, dynamic>,
),
shakeDetectionSettings: json['shakeDetectionSettings'] == null
? const ShakeDetectionSettings()
: ShakeDetectionSettings.fromJson(
json['shakeDetectionSettings'] as Map<String, dynamic>,
),
homePageSettings: json['homePageSettings'] == null
? const HomePageSettings()
: HomePageSettings.fromJson(
json['homePageSettings'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) =>
Map<String, dynamic> _$AppSettingsToJson(_AppSettings instance) =>
<String, dynamic>{
'themeSettings': instance.themeSettings,
'playerSettings': instance.playerSettings,
@ -49,9 +51,10 @@ Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) =>
'homePageSettings': instance.homePageSettings,
};
_$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
_$ThemeSettingsImpl(
themeMode: $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ??
_ThemeSettings _$ThemeSettingsFromJson(Map<String, dynamic> json) =>
_ThemeSettings(
themeMode:
$enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ??
ThemeMode.system,
highContrast: json['highContrast'] as bool? ?? false,
useMaterialThemeFromSystem:
@ -63,7 +66,7 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
json['useCurrentPlayerThemeThroughoutApp'] as bool? ?? true,
);
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
Map<String, dynamic> _$ThemeSettingsToJson(_ThemeSettings instance) =>
<String, dynamic>{
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
'highContrast': instance.highContrast,
@ -80,96 +83,97 @@ const _$ThemeModeEnumMap = {
ThemeMode.dark: 'dark',
};
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
_$PlayerSettingsImpl(
miniPlayerSettings: json['miniPlayerSettings'] == null
? const MinimizedPlayerSettings()
: MinimizedPlayerSettings.fromJson(
json['miniPlayerSettings'] as Map<String, dynamic>),
expandedPlayerSettings: json['expandedPlayerSettings'] == null
? const ExpandedPlayerSettings()
: ExpandedPlayerSettings.fromJson(
json['expandedPlayerSettings'] as Map<String, dynamic>),
preferredDefaultVolume:
(json['preferredDefaultVolume'] as num?)?.toDouble() ?? 1,
preferredDefaultSpeed:
(json['preferredDefaultSpeed'] as num?)?.toDouble() ?? 1,
speedOptions: (json['speedOptions'] as List<dynamic>?)
?.map((e) => (e as num).toDouble())
.toList() ??
const [1, 1.25, 1.5, 1.75, 2],
speedIncrement: (json['speedIncrement'] as num?)?.toDouble() ?? 0.05,
minSpeed: (json['minSpeed'] as num?)?.toDouble() ?? 0.1,
maxSpeed: (json['maxSpeed'] as num?)?.toDouble() ?? 4,
minimumPositionForReporting: json['minimumPositionForReporting'] == null
? const Duration(seconds: 10)
: Duration(
microseconds:
(json['minimumPositionForReporting'] as num).toInt()),
playbackReportInterval: json['playbackReportInterval'] == null
? const Duration(seconds: 10)
: Duration(
microseconds: (json['playbackReportInterval'] as num).toInt()),
markCompleteWhenTimeLeft: json['markCompleteWhenTimeLeft'] == null
? const Duration(seconds: 15)
: Duration(
microseconds: (json['markCompleteWhenTimeLeft'] as num).toInt()),
configurePlayerForEveryBook:
json['configurePlayerForEveryBook'] as bool? ?? true,
);
_PlayerSettings _$PlayerSettingsFromJson(
Map<String, dynamic> json,
) => _PlayerSettings(
miniPlayerSettings: json['miniPlayerSettings'] == null
? const MinimizedPlayerSettings()
: MinimizedPlayerSettings.fromJson(
json['miniPlayerSettings'] as Map<String, dynamic>,
),
expandedPlayerSettings: json['expandedPlayerSettings'] == null
? const ExpandedPlayerSettings()
: ExpandedPlayerSettings.fromJson(
json['expandedPlayerSettings'] as Map<String, dynamic>,
),
preferredDefaultVolume:
(json['preferredDefaultVolume'] as num?)?.toDouble() ?? 1,
preferredDefaultSpeed:
(json['preferredDefaultSpeed'] as num?)?.toDouble() ?? 1,
speedOptions:
(json['speedOptions'] as List<dynamic>?)
?.map((e) => (e as num).toDouble())
.toList() ??
const [1, 1.25, 1.5, 1.75, 2],
speedIncrement: (json['speedIncrement'] as num?)?.toDouble() ?? 0.05,
minSpeed: (json['minSpeed'] as num?)?.toDouble() ?? 0.1,
maxSpeed: (json['maxSpeed'] as num?)?.toDouble() ?? 4,
minimumPositionForReporting: json['minimumPositionForReporting'] == null
? const Duration(seconds: 10)
: Duration(
microseconds: (json['minimumPositionForReporting'] as num).toInt(),
),
playbackReportInterval: json['playbackReportInterval'] == null
? const Duration(seconds: 10)
: Duration(microseconds: (json['playbackReportInterval'] as num).toInt()),
markCompleteWhenTimeLeft: json['markCompleteWhenTimeLeft'] == null
? const Duration(seconds: 15)
: Duration(
microseconds: (json['markCompleteWhenTimeLeft'] as num).toInt(),
),
configurePlayerForEveryBook:
json['configurePlayerForEveryBook'] as bool? ?? true,
);
Map<String, dynamic> _$$PlayerSettingsImplToJson(
_$PlayerSettingsImpl instance) =>
<String, dynamic>{
'miniPlayerSettings': instance.miniPlayerSettings,
'expandedPlayerSettings': instance.expandedPlayerSettings,
'preferredDefaultVolume': instance.preferredDefaultVolume,
'preferredDefaultSpeed': instance.preferredDefaultSpeed,
'speedOptions': instance.speedOptions,
'speedIncrement': instance.speedIncrement,
'minSpeed': instance.minSpeed,
'maxSpeed': instance.maxSpeed,
'minimumPositionForReporting':
instance.minimumPositionForReporting.inMicroseconds,
'playbackReportInterval': instance.playbackReportInterval.inMicroseconds,
'markCompleteWhenTimeLeft':
instance.markCompleteWhenTimeLeft.inMicroseconds,
'configurePlayerForEveryBook': instance.configurePlayerForEveryBook,
};
Map<String, dynamic> _$PlayerSettingsToJson(
_PlayerSettings instance,
) => <String, dynamic>{
'miniPlayerSettings': instance.miniPlayerSettings,
'expandedPlayerSettings': instance.expandedPlayerSettings,
'preferredDefaultVolume': instance.preferredDefaultVolume,
'preferredDefaultSpeed': instance.preferredDefaultSpeed,
'speedOptions': instance.speedOptions,
'speedIncrement': instance.speedIncrement,
'minSpeed': instance.minSpeed,
'maxSpeed': instance.maxSpeed,
'minimumPositionForReporting':
instance.minimumPositionForReporting.inMicroseconds,
'playbackReportInterval': instance.playbackReportInterval.inMicroseconds,
'markCompleteWhenTimeLeft': instance.markCompleteWhenTimeLeft.inMicroseconds,
'configurePlayerForEveryBook': instance.configurePlayerForEveryBook,
};
_$ExpandedPlayerSettingsImpl _$$ExpandedPlayerSettingsImplFromJson(
Map<String, dynamic> json) =>
_$ExpandedPlayerSettingsImpl(
showTotalProgress: json['showTotalProgress'] as bool? ?? false,
showChapterProgress: json['showChapterProgress'] as bool? ?? true,
);
_ExpandedPlayerSettings _$ExpandedPlayerSettingsFromJson(
Map<String, dynamic> json,
) => _ExpandedPlayerSettings(
showTotalProgress: json['showTotalProgress'] as bool? ?? false,
showChapterProgress: json['showChapterProgress'] as bool? ?? true,
);
Map<String, dynamic> _$$ExpandedPlayerSettingsImplToJson(
_$ExpandedPlayerSettingsImpl instance) =>
<String, dynamic>{
'showTotalProgress': instance.showTotalProgress,
'showChapterProgress': instance.showChapterProgress,
};
Map<String, dynamic> _$ExpandedPlayerSettingsToJson(
_ExpandedPlayerSettings instance,
) => <String, dynamic>{
'showTotalProgress': instance.showTotalProgress,
'showChapterProgress': instance.showChapterProgress,
};
_$MinimizedPlayerSettingsImpl _$$MinimizedPlayerSettingsImplFromJson(
Map<String, dynamic> json) =>
_$MinimizedPlayerSettingsImpl(
useChapterInfo: json['useChapterInfo'] as bool? ?? false,
);
_MinimizedPlayerSettings _$MinimizedPlayerSettingsFromJson(
Map<String, dynamic> json,
) => _MinimizedPlayerSettings(
useChapterInfo: json['useChapterInfo'] as bool? ?? false,
);
Map<String, dynamic> _$$MinimizedPlayerSettingsImplToJson(
_$MinimizedPlayerSettingsImpl instance) =>
<String, dynamic>{
'useChapterInfo': instance.useChapterInfo,
};
Map<String, dynamic> _$MinimizedPlayerSettingsToJson(
_MinimizedPlayerSettings instance,
) => <String, dynamic>{'useChapterInfo': instance.useChapterInfo};
_$SleepTimerSettingsImpl _$$SleepTimerSettingsImplFromJson(
Map<String, dynamic> json) =>
_$SleepTimerSettingsImpl(
_SleepTimerSettings _$SleepTimerSettingsFromJson(Map<String, dynamic> json) =>
_SleepTimerSettings(
defaultDuration: json['defaultDuration'] == null
? const Duration(minutes: 15)
: Duration(microseconds: (json['defaultDuration'] as num).toInt()),
presetDurations: (json['presetDurations'] as List<dynamic>?)
presetDurations:
(json['presetDurations'] as List<dynamic>?)
?.map((e) => Duration(microseconds: (e as num).toInt()))
.toList() ??
const [
@ -177,7 +181,7 @@ _$SleepTimerSettingsImpl _$$SleepTimerSettingsImplFromJson(
Duration(minutes: 10),
Duration(minutes: 15),
Duration(minutes: 20),
Duration(minutes: 30)
Duration(minutes: 30),
],
maxDuration: json['maxDuration'] == null
? const Duration(minutes: 100)
@ -189,16 +193,18 @@ _$SleepTimerSettingsImpl _$$SleepTimerSettingsImplFromJson(
autoRewindWhenStopped: json['autoRewindWhenStopped'] as bool? ?? false,
autoRewindDurations:
(json['autoRewindDurations'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
int.parse(k), Duration(microseconds: (e as num).toInt())),
) ??
const {
5: Duration(seconds: 10),
15: Duration(seconds: 30),
45: Duration(seconds: 45),
60: Duration(minutes: 1),
120: Duration(minutes: 2)
},
(k, e) => MapEntry(
int.parse(k),
Duration(microseconds: (e as num).toInt()),
),
) ??
const {
5: Duration(seconds: 10),
15: Duration(seconds: 30),
45: Duration(seconds: 45),
60: Duration(minutes: 1),
120: Duration(minutes: 2),
},
autoTurnOnTimer: json['autoTurnOnTimer'] as bool? ?? false,
alwaysAutoTurnOnTimer: json['alwaysAutoTurnOnTimer'] as bool? ?? false,
autoTurnOnTime: json['autoTurnOnTime'] == null
@ -209,27 +215,27 @@ _$SleepTimerSettingsImpl _$$SleepTimerSettingsImplFromJson(
: Duration(microseconds: (json['autoTurnOffTime'] as num).toInt()),
);
Map<String, dynamic> _$$SleepTimerSettingsImplToJson(
_$SleepTimerSettingsImpl instance) =>
Map<String, dynamic> _$SleepTimerSettingsToJson(_SleepTimerSettings instance) =>
<String, dynamic>{
'defaultDuration': instance.defaultDuration.inMicroseconds,
'presetDurations':
instance.presetDurations.map((e) => e.inMicroseconds).toList(),
'presetDurations': instance.presetDurations
.map((e) => e.inMicroseconds)
.toList(),
'maxDuration': instance.maxDuration.inMicroseconds,
'fadeOutAudio': instance.fadeOutAudio,
'fadeOutDuration': instance.fadeOutDuration.inMicroseconds,
'autoRewindWhenStopped': instance.autoRewindWhenStopped,
'autoRewindDurations': instance.autoRewindDurations
.map((k, e) => MapEntry(k.toString(), e.inMicroseconds)),
'autoRewindDurations': instance.autoRewindDurations.map(
(k, e) => MapEntry(k.toString(), e.inMicroseconds),
),
'autoTurnOnTimer': instance.autoTurnOnTimer,
'alwaysAutoTurnOnTimer': instance.alwaysAutoTurnOnTimer,
'autoTurnOnTime': instance.autoTurnOnTime.inMicroseconds,
'autoTurnOffTime': instance.autoTurnOffTime.inMicroseconds,
};
_$DownloadSettingsImpl _$$DownloadSettingsImplFromJson(
Map<String, dynamic> json) =>
_$DownloadSettingsImpl(
_DownloadSettings _$DownloadSettingsFromJson(Map<String, dynamic> json) =>
_DownloadSettings(
requiresWiFi: json['requiresWiFi'] as bool? ?? true,
retries: (json['retries'] as num?)?.toInt() ?? 3,
allowPause: json['allowPause'] as bool? ?? true,
@ -239,8 +245,7 @@ _$DownloadSettingsImpl _$$DownloadSettingsImplFromJson(
(json['maxConcurrentByGroup'] as num?)?.toInt() ?? 3,
);
Map<String, dynamic> _$$DownloadSettingsImplToJson(
_$DownloadSettingsImpl instance) =>
Map<String, dynamic> _$DownloadSettingsToJson(_DownloadSettings instance) =>
<String, dynamic>{
'requiresWiFi': instance.requiresWiFi,
'retries': instance.retries,
@ -250,43 +255,43 @@ Map<String, dynamic> _$$DownloadSettingsImplToJson(
'maxConcurrentByGroup': instance.maxConcurrentByGroup,
};
_$NotificationSettingsImpl _$$NotificationSettingsImplFromJson(
Map<String, dynamic> json) =>
_$NotificationSettingsImpl(
fastForwardInterval: json['fastForwardInterval'] == null
? const Duration(seconds: 30)
: Duration(
microseconds: (json['fastForwardInterval'] as num).toInt()),
rewindInterval: json['rewindInterval'] == null
? const Duration(seconds: 10)
: Duration(microseconds: (json['rewindInterval'] as num).toInt()),
progressBarIsChapterProgress:
json['progressBarIsChapterProgress'] as bool? ?? true,
primaryTitle: json['primaryTitle'] as String? ?? '\$bookTitle',
secondaryTitle: json['secondaryTitle'] as String? ?? '\$author',
mediaControls: (json['mediaControls'] as List<dynamic>?)
?.map((e) => $enumDecode(_$NotificationMediaControlEnumMap, e))
.toList() ??
const [
NotificationMediaControl.rewind,
NotificationMediaControl.fastForward,
NotificationMediaControl.skipToPreviousChapter,
NotificationMediaControl.skipToNextChapter
],
);
_NotificationSettings _$NotificationSettingsFromJson(
Map<String, dynamic> json,
) => _NotificationSettings(
fastForwardInterval: json['fastForwardInterval'] == null
? const Duration(seconds: 30)
: Duration(microseconds: (json['fastForwardInterval'] as num).toInt()),
rewindInterval: json['rewindInterval'] == null
? const Duration(seconds: 10)
: Duration(microseconds: (json['rewindInterval'] as num).toInt()),
progressBarIsChapterProgress:
json['progressBarIsChapterProgress'] as bool? ?? true,
primaryTitle: json['primaryTitle'] as String? ?? '\$bookTitle',
secondaryTitle: json['secondaryTitle'] as String? ?? '\$author',
mediaControls:
(json['mediaControls'] as List<dynamic>?)
?.map((e) => $enumDecode(_$NotificationMediaControlEnumMap, e))
.toList() ??
const [
NotificationMediaControl.rewind,
NotificationMediaControl.fastForward,
NotificationMediaControl.skipToPreviousChapter,
NotificationMediaControl.skipToNextChapter,
],
);
Map<String, dynamic> _$$NotificationSettingsImplToJson(
_$NotificationSettingsImpl instance) =>
<String, dynamic>{
'fastForwardInterval': instance.fastForwardInterval.inMicroseconds,
'rewindInterval': instance.rewindInterval.inMicroseconds,
'progressBarIsChapterProgress': instance.progressBarIsChapterProgress,
'primaryTitle': instance.primaryTitle,
'secondaryTitle': instance.secondaryTitle,
'mediaControls': instance.mediaControls
.map((e) => _$NotificationMediaControlEnumMap[e]!)
.toList(),
};
Map<String, dynamic> _$NotificationSettingsToJson(
_NotificationSettings instance,
) => <String, dynamic>{
'fastForwardInterval': instance.fastForwardInterval.inMicroseconds,
'rewindInterval': instance.rewindInterval.inMicroseconds,
'progressBarIsChapterProgress': instance.progressBarIsChapterProgress,
'primaryTitle': instance.primaryTitle,
'secondaryTitle': instance.secondaryTitle,
'mediaControls': instance.mediaControls
.map((e) => _$NotificationMediaControlEnumMap[e]!)
.toList(),
};
const _$NotificationMediaControlEnumMap = {
NotificationMediaControl.fastForward: 'fastForward',
@ -297,47 +302,47 @@ const _$NotificationMediaControlEnumMap = {
NotificationMediaControl.skipToPreviousChapter: 'skipToPreviousChapter',
};
_$ShakeDetectionSettingsImpl _$$ShakeDetectionSettingsImplFromJson(
Map<String, dynamic> json) =>
_$ShakeDetectionSettingsImpl(
isEnabled: json['isEnabled'] as bool? ?? true,
direction:
$enumDecodeNullable(_$ShakeDirectionEnumMap, json['direction']) ??
ShakeDirection.horizontal,
threshold: (json['threshold'] as num?)?.toDouble() ?? 5,
shakeAction:
$enumDecodeNullable(_$ShakeActionEnumMap, json['shakeAction']) ??
ShakeAction.resetSleepTimer,
feedback: (json['feedback'] as List<dynamic>?)
?.map((e) => $enumDecode(_$ShakeDetectedFeedbackEnumMap, e))
.toSet() ??
const {ShakeDetectedFeedback.vibrate},
beepVolume: (json['beepVolume'] as num?)?.toDouble() ?? 0.5,
shakeTriggerCoolDown: json['shakeTriggerCoolDown'] == null
? const Duration(seconds: 2)
: Duration(
microseconds: (json['shakeTriggerCoolDown'] as num).toInt()),
shakeTriggerCount: (json['shakeTriggerCount'] as num?)?.toInt() ?? 2,
samplingPeriod: json['samplingPeriod'] == null
? const Duration(milliseconds: 100)
: Duration(microseconds: (json['samplingPeriod'] as num).toInt()),
);
_ShakeDetectionSettings _$ShakeDetectionSettingsFromJson(
Map<String, dynamic> json,
) => _ShakeDetectionSettings(
isEnabled: json['isEnabled'] as bool? ?? true,
direction:
$enumDecodeNullable(_$ShakeDirectionEnumMap, json['direction']) ??
ShakeDirection.horizontal,
threshold: (json['threshold'] as num?)?.toDouble() ?? 5,
shakeAction:
$enumDecodeNullable(_$ShakeActionEnumMap, json['shakeAction']) ??
ShakeAction.resetSleepTimer,
feedback:
(json['feedback'] as List<dynamic>?)
?.map((e) => $enumDecode(_$ShakeDetectedFeedbackEnumMap, e))
.toSet() ??
const {ShakeDetectedFeedback.vibrate},
beepVolume: (json['beepVolume'] as num?)?.toDouble() ?? 0.5,
shakeTriggerCoolDown: json['shakeTriggerCoolDown'] == null
? const Duration(seconds: 2)
: Duration(microseconds: (json['shakeTriggerCoolDown'] as num).toInt()),
shakeTriggerCount: (json['shakeTriggerCount'] as num?)?.toInt() ?? 2,
samplingPeriod: json['samplingPeriod'] == null
? const Duration(milliseconds: 100)
: Duration(microseconds: (json['samplingPeriod'] as num).toInt()),
);
Map<String, dynamic> _$$ShakeDetectionSettingsImplToJson(
_$ShakeDetectionSettingsImpl instance) =>
<String, dynamic>{
'isEnabled': instance.isEnabled,
'direction': _$ShakeDirectionEnumMap[instance.direction]!,
'threshold': instance.threshold,
'shakeAction': _$ShakeActionEnumMap[instance.shakeAction]!,
'feedback': instance.feedback
.map((e) => _$ShakeDetectedFeedbackEnumMap[e]!)
.toList(),
'beepVolume': instance.beepVolume,
'shakeTriggerCoolDown': instance.shakeTriggerCoolDown.inMicroseconds,
'shakeTriggerCount': instance.shakeTriggerCount,
'samplingPeriod': instance.samplingPeriod.inMicroseconds,
};
Map<String, dynamic> _$ShakeDetectionSettingsToJson(
_ShakeDetectionSettings instance,
) => <String, dynamic>{
'isEnabled': instance.isEnabled,
'direction': _$ShakeDirectionEnumMap[instance.direction]!,
'threshold': instance.threshold,
'shakeAction': _$ShakeActionEnumMap[instance.shakeAction]!,
'feedback': instance.feedback
.map((e) => _$ShakeDetectedFeedbackEnumMap[e]!)
.toList(),
'beepVolume': instance.beepVolume,
'shakeTriggerCoolDown': instance.shakeTriggerCoolDown.inMicroseconds,
'shakeTriggerCount': instance.shakeTriggerCount,
'samplingPeriod': instance.samplingPeriod.inMicroseconds,
};
const _$ShakeDirectionEnumMap = {
ShakeDirection.horizontal: 'horizontal',
@ -357,9 +362,8 @@ const _$ShakeDetectedFeedbackEnumMap = {
ShakeDetectedFeedback.beep: 'beep',
};
_$HomePageSettingsImpl _$$HomePageSettingsImplFromJson(
Map<String, dynamic> json) =>
_$HomePageSettingsImpl(
_HomePageSettings _$HomePageSettingsFromJson(Map<String, dynamic> json) =>
_HomePageSettings(
showPlayButtonOnContinueListeningShelf:
json['showPlayButtonOnContinueListeningShelf'] as bool? ?? true,
showPlayButtonOnContinueSeriesShelf:
@ -370,15 +374,14 @@ _$HomePageSettingsImpl _$$HomePageSettingsImplFromJson(
json['showPlayButtonOnListenAgainShelf'] as bool? ?? false,
);
Map<String, dynamic> _$$HomePageSettingsImplToJson(
_$HomePageSettingsImpl instance) =>
<String, dynamic>{
'showPlayButtonOnContinueListeningShelf':
instance.showPlayButtonOnContinueListeningShelf,
'showPlayButtonOnContinueSeriesShelf':
instance.showPlayButtonOnContinueSeriesShelf,
'showPlayButtonOnAllRemainingShelves':
instance.showPlayButtonOnAllRemainingShelves,
'showPlayButtonOnListenAgainShelf':
instance.showPlayButtonOnListenAgainShelf,
};
Map<String, dynamic> _$HomePageSettingsToJson(
_HomePageSettings instance,
) => <String, dynamic>{
'showPlayButtonOnContinueListeningShelf':
instance.showPlayButtonOnContinueListeningShelf,
'showPlayButtonOnContinueSeriesShelf':
instance.showPlayButtonOnContinueSeriesShelf,
'showPlayButtonOnAllRemainingShelves':
instance.showPlayButtonOnAllRemainingShelves,
'showPlayButtonOnListenAgainShelf': instance.showPlayButtonOnListenAgainShelf,
};

View file

@ -7,7 +7,7 @@ typedef AudiobookShelfUri = Uri;
/// Represents a audiobookshelf server
@freezed
class AudiobookShelfServer with _$AudiobookShelfServer {
sealed class AudiobookShelfServer with _$AudiobookShelfServer {
const factory AudiobookShelfServer({
required AudiobookShelfUri serverUrl,
// String? serverName,

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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
@ -9,161 +9,263 @@ part of 'audiobookshelf_server.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
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');
AudiobookShelfServer _$AudiobookShelfServerFromJson(Map<String, dynamic> json) {
return _AudiobookShelfServer.fromJson(json);
}
/// @nodoc
mixin _$AudiobookShelfServer {
Uri get serverUrl => throw _privateConstructorUsedError;
AudiobookShelfUri get serverUrl;
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<AudiobookShelfServer> get copyWith => _$AudiobookShelfServerCopyWithImpl<AudiobookShelfServer>(this as AudiobookShelfServer, _$identity);
/// Serializes this AudiobookShelfServer to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AudiobookShelfServer&&(identical(other.serverUrl, serverUrl) || other.serverUrl == serverUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,serverUrl);
@override
String toString() {
return 'AudiobookShelfServer(serverUrl: $serverUrl)';
}
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AudiobookShelfServerCopyWith<AudiobookShelfServer> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AudiobookShelfServerCopyWith<$Res> {
factory $AudiobookShelfServerCopyWith(AudiobookShelfServer value,
$Res Function(AudiobookShelfServer) then) =
_$AudiobookShelfServerCopyWithImpl<$Res, AudiobookShelfServer>;
@useResult
$Res call({Uri serverUrl});
}
abstract mixin class $AudiobookShelfServerCopyWith<$Res> {
factory $AudiobookShelfServerCopyWith(AudiobookShelfServer value, $Res Function(AudiobookShelfServer) _then) = _$AudiobookShelfServerCopyWithImpl;
@useResult
$Res call({
AudiobookShelfUri serverUrl
});
}
/// @nodoc
class _$AudiobookShelfServerCopyWithImpl<$Res,
$Val extends AudiobookShelfServer>
class _$AudiobookShelfServerCopyWithImpl<$Res>
implements $AudiobookShelfServerCopyWith<$Res> {
_$AudiobookShelfServerCopyWithImpl(this._value, this._then);
_$AudiobookShelfServerCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final AudiobookShelfServer _self;
final $Res Function(AudiobookShelfServer) _then;
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? serverUrl = null,
}) {
return _then(_value.copyWith(
serverUrl: null == serverUrl
? _value.serverUrl
: serverUrl // ignore: cast_nullable_to_non_nullable
as Uri,
) as $Val);
}
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? serverUrl = null,}) {
return _then(_self.copyWith(
serverUrl: null == serverUrl ? _self.serverUrl : serverUrl // ignore: cast_nullable_to_non_nullable
as AudiobookShelfUri,
));
}
/// @nodoc
abstract class _$$AudiobookShelfServerImplCopyWith<$Res>
implements $AudiobookShelfServerCopyWith<$Res> {
factory _$$AudiobookShelfServerImplCopyWith(_$AudiobookShelfServerImpl value,
$Res Function(_$AudiobookShelfServerImpl) then) =
__$$AudiobookShelfServerImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({Uri serverUrl});
}
/// @nodoc
class __$$AudiobookShelfServerImplCopyWithImpl<$Res>
extends _$AudiobookShelfServerCopyWithImpl<$Res, _$AudiobookShelfServerImpl>
implements _$$AudiobookShelfServerImplCopyWith<$Res> {
__$$AudiobookShelfServerImplCopyWithImpl(_$AudiobookShelfServerImpl _value,
$Res Function(_$AudiobookShelfServerImpl) _then)
: super(_value, _then);
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? serverUrl = null,
}) {
return _then(_$AudiobookShelfServerImpl(
serverUrl: null == serverUrl
? _value.serverUrl
: serverUrl // ignore: cast_nullable_to_non_nullable
as Uri,
));
}
/// Adds pattern-matching-related methods to [AudiobookShelfServer].
extension AudiobookShelfServerPatterns on AudiobookShelfServer {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AudiobookShelfServer value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AudiobookShelfServer() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AudiobookShelfServer value) $default,){
final _that = this;
switch (_that) {
case _AudiobookShelfServer():
return $default(_that);}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AudiobookShelfServer value)? $default,){
final _that = this;
switch (_that) {
case _AudiobookShelfServer() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( AudiobookShelfUri serverUrl)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AudiobookShelfServer() when $default != null:
return $default(_that.serverUrl);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( AudiobookShelfUri serverUrl) $default,) {final _that = this;
switch (_that) {
case _AudiobookShelfServer():
return $default(_that.serverUrl);}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( AudiobookShelfUri serverUrl)? $default,) {final _that = this;
switch (_that) {
case _AudiobookShelfServer() when $default != null:
return $default(_that.serverUrl);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _$AudiobookShelfServerImpl implements _AudiobookShelfServer {
const _$AudiobookShelfServerImpl({required this.serverUrl});
factory _$AudiobookShelfServerImpl.fromJson(Map<String, dynamic> json) =>
_$$AudiobookShelfServerImplFromJson(json);
class _AudiobookShelfServer implements AudiobookShelfServer {
const _AudiobookShelfServer({required this.serverUrl});
factory _AudiobookShelfServer.fromJson(Map<String, dynamic> json) => _$AudiobookShelfServerFromJson(json);
@override
final Uri serverUrl;
@override final AudiobookShelfUri serverUrl;
@override
String toString() {
return 'AudiobookShelfServer(serverUrl: $serverUrl)';
}
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AudiobookShelfServerCopyWith<_AudiobookShelfServer> get copyWith => __$AudiobookShelfServerCopyWithImpl<_AudiobookShelfServer>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AudiobookShelfServerImpl &&
(identical(other.serverUrl, serverUrl) ||
other.serverUrl == serverUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, serverUrl);
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AudiobookShelfServerImplCopyWith<_$AudiobookShelfServerImpl>
get copyWith =>
__$$AudiobookShelfServerImplCopyWithImpl<_$AudiobookShelfServerImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AudiobookShelfServerImplToJson(
this,
);
}
@override
Map<String, dynamic> toJson() {
return _$AudiobookShelfServerToJson(this, );
}
abstract class _AudiobookShelfServer implements AudiobookShelfServer {
const factory _AudiobookShelfServer({required final Uri serverUrl}) =
_$AudiobookShelfServerImpl;
factory _AudiobookShelfServer.fromJson(Map<String, dynamic> json) =
_$AudiobookShelfServerImpl.fromJson;
@override
Uri get serverUrl;
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AudiobookShelfServerImplCopyWith<_$AudiobookShelfServerImpl>
get copyWith => throw _privateConstructorUsedError;
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AudiobookShelfServer&&(identical(other.serverUrl, serverUrl) || other.serverUrl == serverUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,serverUrl);
@override
String toString() {
return 'AudiobookShelfServer(serverUrl: $serverUrl)';
}
}
/// @nodoc
abstract mixin class _$AudiobookShelfServerCopyWith<$Res> implements $AudiobookShelfServerCopyWith<$Res> {
factory _$AudiobookShelfServerCopyWith(_AudiobookShelfServer value, $Res Function(_AudiobookShelfServer) _then) = __$AudiobookShelfServerCopyWithImpl;
@override @useResult
$Res call({
AudiobookShelfUri serverUrl
});
}
/// @nodoc
class __$AudiobookShelfServerCopyWithImpl<$Res>
implements _$AudiobookShelfServerCopyWith<$Res> {
__$AudiobookShelfServerCopyWithImpl(this._self, this._then);
final _AudiobookShelfServer _self;
final $Res Function(_AudiobookShelfServer) _then;
/// Create a copy of AudiobookShelfServer
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? serverUrl = null,}) {
return _then(_AudiobookShelfServer(
serverUrl: null == serverUrl ? _self.serverUrl : serverUrl // ignore: cast_nullable_to_non_nullable
as AudiobookShelfUri,
));
}
}
// dart format on

View file

@ -6,14 +6,10 @@ part of 'audiobookshelf_server.dart';
// JsonSerializableGenerator
// **************************************************************************
_$AudiobookShelfServerImpl _$$AudiobookShelfServerImplFromJson(
Map<String, dynamic> json) =>
_$AudiobookShelfServerImpl(
serverUrl: Uri.parse(json['serverUrl'] as String),
);
_AudiobookShelfServer _$AudiobookShelfServerFromJson(
Map<String, dynamic> json,
) => _AudiobookShelfServer(serverUrl: Uri.parse(json['serverUrl'] as String));
Map<String, dynamic> _$$AudiobookShelfServerImplToJson(
_$AudiobookShelfServerImpl instance) =>
<String, dynamic>{
'serverUrl': instance.serverUrl.toString(),
};
Map<String, dynamic> _$AudiobookShelfServerToJson(
_AudiobookShelfServer instance,
) => <String, dynamic>{'serverUrl': instance.serverUrl.toString()};

View file

@ -6,7 +6,7 @@ part 'authenticated_user.g.dart';
/// authenticated user with server and credentials
@freezed
class AuthenticatedUser with _$AuthenticatedUser {
sealed class AuthenticatedUser with _$AuthenticatedUser {
const factory AuthenticatedUser({
required AudiobookShelfServer server,
required String authToken,

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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
@ -9,238 +9,290 @@ part of 'authenticated_user.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
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');
AuthenticatedUser _$AuthenticatedUserFromJson(Map<String, dynamic> json) {
return _AuthenticatedUser.fromJson(json);
}
/// @nodoc
mixin _$AuthenticatedUser {
AudiobookShelfServer get server => throw _privateConstructorUsedError;
String get authToken => throw _privateConstructorUsedError;
String get id => throw _privateConstructorUsedError;
String? get username => throw _privateConstructorUsedError;
AudiobookShelfServer get server; String get authToken; String get id; String? get username;
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AuthenticatedUserCopyWith<AuthenticatedUser> get copyWith => _$AuthenticatedUserCopyWithImpl<AuthenticatedUser>(this as AuthenticatedUser, _$identity);
/// Serializes this AuthenticatedUser to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthenticatedUser&&(identical(other.server, server) || other.server == server)&&(identical(other.authToken, authToken) || other.authToken == authToken)&&(identical(other.id, id) || other.id == id)&&(identical(other.username, username) || other.username == username));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,server,authToken,id,username);
@override
String toString() {
return 'AuthenticatedUser(server: $server, authToken: $authToken, id: $id, username: $username)';
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AuthenticatedUserCopyWith<AuthenticatedUser> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AuthenticatedUserCopyWith<$Res> {
factory $AuthenticatedUserCopyWith(
AuthenticatedUser value, $Res Function(AuthenticatedUser) then) =
_$AuthenticatedUserCopyWithImpl<$Res, AuthenticatedUser>;
@useResult
$Res call(
{AudiobookShelfServer server,
String authToken,
String id,
String? username});
abstract mixin class $AuthenticatedUserCopyWith<$Res> {
factory $AuthenticatedUserCopyWith(AuthenticatedUser value, $Res Function(AuthenticatedUser) _then) = _$AuthenticatedUserCopyWithImpl;
@useResult
$Res call({
AudiobookShelfServer server, String authToken, String id, String? username
});
$AudiobookShelfServerCopyWith<$Res> get server;
$AudiobookShelfServerCopyWith<$Res> get server;
}
/// @nodoc
class _$AuthenticatedUserCopyWithImpl<$Res, $Val extends AuthenticatedUser>
class _$AuthenticatedUserCopyWithImpl<$Res>
implements $AuthenticatedUserCopyWith<$Res> {
_$AuthenticatedUserCopyWithImpl(this._value, this._then);
_$AuthenticatedUserCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final AuthenticatedUser _self;
final $Res Function(AuthenticatedUser) _then;
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? server = null,
Object? authToken = null,
Object? id = null,
Object? username = freezed,
}) {
return _then(_value.copyWith(
server: null == server
? _value.server
: server // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer,
authToken: null == authToken
? _value.authToken
: authToken // ignore: cast_nullable_to_non_nullable
as String,
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
username: freezed == username
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res> get server {
return $AudiobookShelfServerCopyWith<$Res>(_value.server, (value) {
return _then(_value.copyWith(server: value) as $Val);
});
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? server = null,Object? authToken = null,Object? id = null,Object? username = freezed,}) {
return _then(_self.copyWith(
server: null == server ? _self.server : server // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer,authToken: null == authToken ? _self.authToken : authToken // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res> get server {
return $AudiobookShelfServerCopyWith<$Res>(_self.server, (value) {
return _then(_self.copyWith(server: value));
});
}
}
/// @nodoc
abstract class _$$AuthenticatedUserImplCopyWith<$Res>
implements $AuthenticatedUserCopyWith<$Res> {
factory _$$AuthenticatedUserImplCopyWith(_$AuthenticatedUserImpl value,
$Res Function(_$AuthenticatedUserImpl) then) =
__$$AuthenticatedUserImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{AudiobookShelfServer server,
String authToken,
String id,
String? username});
@override
$AudiobookShelfServerCopyWith<$Res> get server;
/// Adds pattern-matching-related methods to [AuthenticatedUser].
extension AuthenticatedUserPatterns on AuthenticatedUser {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AuthenticatedUser value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AuthenticatedUser() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AuthenticatedUser value) $default,){
final _that = this;
switch (_that) {
case _AuthenticatedUser():
return $default(_that);}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AuthenticatedUser value)? $default,){
final _that = this;
switch (_that) {
case _AuthenticatedUser() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( AudiobookShelfServer server, String authToken, String id, String? username)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AuthenticatedUser() when $default != null:
return $default(_that.server,_that.authToken,_that.id,_that.username);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( AudiobookShelfServer server, String authToken, String id, String? username) $default,) {final _that = this;
switch (_that) {
case _AuthenticatedUser():
return $default(_that.server,_that.authToken,_that.id,_that.username);}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( AudiobookShelfServer server, String authToken, String id, String? username)? $default,) {final _that = this;
switch (_that) {
case _AuthenticatedUser() when $default != null:
return $default(_that.server,_that.authToken,_that.id,_that.username);case _:
return null;
}
}
/// @nodoc
class __$$AuthenticatedUserImplCopyWithImpl<$Res>
extends _$AuthenticatedUserCopyWithImpl<$Res, _$AuthenticatedUserImpl>
implements _$$AuthenticatedUserImplCopyWith<$Res> {
__$$AuthenticatedUserImplCopyWithImpl(_$AuthenticatedUserImpl _value,
$Res Function(_$AuthenticatedUserImpl) _then)
: super(_value, _then);
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? server = null,
Object? authToken = null,
Object? id = null,
Object? username = freezed,
}) {
return _then(_$AuthenticatedUserImpl(
server: null == server
? _value.server
: server // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer,
authToken: null == authToken
? _value.authToken
: authToken // ignore: cast_nullable_to_non_nullable
as String,
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
username: freezed == username
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$AuthenticatedUserImpl implements _AuthenticatedUser {
const _$AuthenticatedUserImpl(
{required this.server,
required this.authToken,
required this.id,
this.username});
factory _$AuthenticatedUserImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthenticatedUserImplFromJson(json);
class _AuthenticatedUser implements AuthenticatedUser {
const _AuthenticatedUser({required this.server, required this.authToken, required this.id, this.username});
factory _AuthenticatedUser.fromJson(Map<String, dynamic> json) => _$AuthenticatedUserFromJson(json);
@override
final AudiobookShelfServer server;
@override
final String authToken;
@override
final String id;
@override
final String? username;
@override final AudiobookShelfServer server;
@override final String authToken;
@override final String id;
@override final String? username;
@override
String toString() {
return 'AuthenticatedUser(server: $server, authToken: $authToken, id: $id, username: $username)';
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AuthenticatedUserCopyWith<_AuthenticatedUser> get copyWith => __$AuthenticatedUserCopyWithImpl<_AuthenticatedUser>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AuthenticatedUserImpl &&
(identical(other.server, server) || other.server == server) &&
(identical(other.authToken, authToken) ||
other.authToken == authToken) &&
(identical(other.id, id) || other.id == id) &&
(identical(other.username, username) ||
other.username == username));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, server, authToken, id, username);
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AuthenticatedUserImplCopyWith<_$AuthenticatedUserImpl> get copyWith =>
__$$AuthenticatedUserImplCopyWithImpl<_$AuthenticatedUserImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AuthenticatedUserImplToJson(
this,
);
}
@override
Map<String, dynamic> toJson() {
return _$AuthenticatedUserToJson(this, );
}
abstract class _AuthenticatedUser implements AuthenticatedUser {
const factory _AuthenticatedUser(
{required final AudiobookShelfServer server,
required final String authToken,
required final String id,
final String? username}) = _$AuthenticatedUserImpl;
factory _AuthenticatedUser.fromJson(Map<String, dynamic> json) =
_$AuthenticatedUserImpl.fromJson;
@override
AudiobookShelfServer get server;
@override
String get authToken;
@override
String get id;
@override
String? get username;
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AuthenticatedUserImplCopyWith<_$AuthenticatedUserImpl> get copyWith =>
throw _privateConstructorUsedError;
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthenticatedUser&&(identical(other.server, server) || other.server == server)&&(identical(other.authToken, authToken) || other.authToken == authToken)&&(identical(other.id, id) || other.id == id)&&(identical(other.username, username) || other.username == username));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,server,authToken,id,username);
@override
String toString() {
return 'AuthenticatedUser(server: $server, authToken: $authToken, id: $id, username: $username)';
}
}
/// @nodoc
abstract mixin class _$AuthenticatedUserCopyWith<$Res> implements $AuthenticatedUserCopyWith<$Res> {
factory _$AuthenticatedUserCopyWith(_AuthenticatedUser value, $Res Function(_AuthenticatedUser) _then) = __$AuthenticatedUserCopyWithImpl;
@override @useResult
$Res call({
AudiobookShelfServer server, String authToken, String id, String? username
});
@override $AudiobookShelfServerCopyWith<$Res> get server;
}
/// @nodoc
class __$AuthenticatedUserCopyWithImpl<$Res>
implements _$AuthenticatedUserCopyWith<$Res> {
__$AuthenticatedUserCopyWithImpl(this._self, this._then);
final _AuthenticatedUser _self;
final $Res Function(_AuthenticatedUser) _then;
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? server = null,Object? authToken = null,Object? id = null,Object? username = freezed,}) {
return _then(_AuthenticatedUser(
server: null == server ? _self.server : server // ignore: cast_nullable_to_non_nullable
as AudiobookShelfServer,authToken: null == authToken ? _self.authToken : authToken // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of AuthenticatedUser
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AudiobookShelfServerCopyWith<$Res> get server {
return $AudiobookShelfServerCopyWith<$Res>(_self.server, (value) {
return _then(_self.copyWith(server: value));
});
}
}
// dart format on

View file

@ -6,18 +6,17 @@ part of 'authenticated_user.dart';
// JsonSerializableGenerator
// **************************************************************************
_$AuthenticatedUserImpl _$$AuthenticatedUserImplFromJson(
Map<String, dynamic> json) =>
_$AuthenticatedUserImpl(
server:
AudiobookShelfServer.fromJson(json['server'] as Map<String, dynamic>),
_AuthenticatedUser _$AuthenticatedUserFromJson(Map<String, dynamic> json) =>
_AuthenticatedUser(
server: AudiobookShelfServer.fromJson(
json['server'] as Map<String, dynamic>,
),
authToken: json['authToken'] as String,
id: json['id'] as String,
username: json['username'] as String?,
);
Map<String, dynamic> _$$AuthenticatedUserImplToJson(
_$AuthenticatedUserImpl instance) =>
Map<String, dynamic> _$AuthenticatedUserToJson(_AuthenticatedUser instance) =>
<String, dynamic>{
'server': instance.server,
'authToken': instance.authToken,