From a520136e01688e781b0fb0e33c37094eb3d8dab0 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Sat, 10 Jan 2026 16:46:06 +0530 Subject: [PATCH] chore: update flutter and dependencies --- .fvmrc | 2 +- .vscode/settings.json | 2 +- android/app/build.gradle | 12 +- android/settings.gradle | 2 +- lib/api/api_provider.g.dart | 1025 ++-- lib/api/authenticated_users_provider.dart | 2 +- lib/api/authenticated_users_provider.g.dart | 83 +- lib/api/image_provider.g.dart | 215 +- lib/api/library_item_provider.g.dart | 244 +- lib/api/library_provider.dart | 3 +- lib/api/library_provider.g.dart | 274 +- lib/api/server_provider.dart | 2 +- lib/api/server_provider.g.dart | 91 +- lib/db/available_boxes.dart | 2 +- lib/db/cache/schemas/image.g.dart | 1009 --- lib/db/init.dart | 2 +- lib/db/player_prefs/book_prefs.g.dart | 496 -- lib/db/register_models.dart | 2 +- .../downloads/providers/download_manager.dart | 2 +- .../providers/download_manager.g.dart | 967 ++- .../providers/search_controller.g.dart | 72 +- .../providers/search_result_provider.g.dart | 220 +- lib/features/explore/view/explore_page.dart | 2 +- .../view/library_item_actions.dart | 6 +- .../view/library_item_hero_section.dart | 6 +- .../view/library_item_metadata.dart | 2 +- .../item_viewer/view/library_item_page.dart | 2 +- .../view/library_item_sliver_app_bar.dart | 2 +- .../view/library_browser_page.dart | 2 +- .../logging/providers/logs_provider.g.dart | 58 +- lib/features/onboarding/models/flow.dart | 2 +- .../onboarding/models/flow.freezed.dart | 447 +- .../providers/oauth_provider.g.dart | 342 +- .../models/book_settings.dart | 2 +- .../models/book_settings.freezed.dart | 411 +- .../models/book_settings.g.dart | 9 +- .../models/nullable_player_settings.dart | 2 +- .../nullable_player_settings.freezed.dart | 650 +- .../models/nullable_player_settings.g.dart | 76 +- .../providers/book_settings_provider.g.dart | 217 +- .../playback_reporter_provider.g.dart | 66 +- lib/features/player/playlist_provider.g.dart | 67 +- .../player/providers/audiobook_player.g.dart | 138 +- .../currently_playing_provider.g.dart | 185 +- .../player/providers/player_form.dart | 2 +- .../player/providers/player_form.g.dart | 170 +- .../player/view/audiobook_player.dart | 14 +- .../providers/shake_detector.g.dart | 68 +- .../providers/sleep_timer_provider.g.dart | 67 +- lib/main.dart | 12 +- lib/router/models/library_item_extras.dart | 2 +- .../models/library_item_extras.freezed.dart | 350 +- lib/router/scaffold_with_nav_bar.dart | 29 +- lib/settings/api_settings_provider.dart | 2 +- lib/settings/api_settings_provider.g.dart | 65 +- lib/settings/app_settings_provider.dart | 2 +- lib/settings/app_settings_provider.g.dart | 131 +- .../metadata/metadata_provider.g.dart | 182 +- lib/settings/models/api_settings.dart | 2 +- lib/settings/models/api_settings.freezed.dart | 479 +- lib/settings/models/api_settings.g.dart | 25 +- lib/settings/models/app_settings.dart | 63 +- lib/settings/models/app_settings.freezed.dart | 5407 ++++++++--------- lib/settings/models/app_settings.g.dart | 463 +- .../models/audiobookshelf_server.dart | 2 +- .../models/audiobookshelf_server.freezed.dart | 358 +- .../models/audiobookshelf_server.g.dart | 16 +- lib/settings/models/authenticated_user.dart | 2 +- .../models/authenticated_user.freezed.dart | 460 +- lib/settings/models/authenticated_user.g.dart | 13 +- lib/shared/widgets/shelves/book_shelf.dart | 4 +- .../providers/system_theme_provider.g.dart | 207 +- .../theme_from_cover_provider.g.dart | 466 +- linux/flutter/generated_plugin_registrant.cc | 8 +- linux/flutter/generated_plugins.cmake | 2 +- pubspec.lock | 313 +- pubspec.yaml | 23 +- shelfsdk | 2 +- .../flutter/generated_plugin_registrant.cc | 6 +- windows/flutter/generated_plugins.cmake | 2 +- 80 files changed, 7701 insertions(+), 9141 deletions(-) delete mode 100644 lib/db/cache/schemas/image.g.dart delete mode 100644 lib/db/player_prefs/book_prefs.g.dart diff --git a/.fvmrc b/.fvmrc index 3ca65ff..45c2124 100644 --- a/.fvmrc +++ b/.fvmrc @@ -1,3 +1,3 @@ { - "flutter": "3.32.8" + "flutter": "3.38.6" } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ba2d8f..fd30314 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,7 @@ "utsname", "Vaani" ], - "dart.flutterSdkPath": ".fvm/versions/3.32.8", + "dart.flutterSdkPath": ".fvm/versions/3.38.6", "files.exclude": { "**/*.freezed.dart": true, "**/*.g.dart": true diff --git a/android/app/build.gradle b/android/app/build.gradle index 8200a20..49b2a91 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -30,11 +30,11 @@ if (keystorePropertiesFile.exists()) { android { namespace "dr.blank.vaani" - compileSdk 36 - // ndkVersion flutter.ndkVersion + compileSdk flutter.compileSdkVersion + ndkVersion flutter.ndkVersion // The NDK version is set to a specific version since it was not building // TODO remove when https://github.com/flutter/flutter/issues/139427 is closed - ndkVersion = "29.0.13113456" + // ndkVersion = "29.0.13113456" compileOptions { @@ -64,8 +64,8 @@ android { applicationId "dr.blank.vaani" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion 23 - targetSdkVersion 36 + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -100,4 +100,4 @@ configurations.all { force "androidx.core:core:1.13.1" force "androidx.core:core-ktx:1.13.1" } -} \ No newline at end of file +} diff --git a/android/settings.gradle b/android/settings.gradle index 7435dcb..4529834 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version '8.10.0' apply false - id "org.jetbrains.kotlin.android" version "2.0.20" apply false + id "org.jetbrains.kotlin.android" version "2.1.10" apply false } include ":app" diff --git a/lib/api/api_provider.g.dart b/lib/api/api_provider.g.dart index 619a729..dabe437 100644 --- a/lib/api/api_provider.g.dart +++ b/lib/api/api_provider.g.dart @@ -6,679 +6,536 @@ part of 'api_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$audiobookshelfApiHash() => r'f23a06c404e11867a7f796877eaca99b8ff25458'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// get the api instance for the given base url -/// -/// Copied from [audiobookshelfApi]. + @ProviderFor(audiobookshelfApi) -const audiobookshelfApiProvider = AudiobookshelfApiFamily(); +final audiobookshelfApiProvider = AudiobookshelfApiFamily._(); /// get the api instance for the given base url -/// -/// Copied from [audiobookshelfApi]. -class AudiobookshelfApiFamily extends Family { - /// get the api instance for the given base url - /// - /// Copied from [audiobookshelfApi]. - const AudiobookshelfApiFamily(); +final class AudiobookshelfApiProvider + extends + $FunctionalProvider< + AudiobookshelfApi, + AudiobookshelfApi, + AudiobookshelfApi + > + with $Provider { /// get the api instance for the given base url - /// - /// Copied from [audiobookshelfApi]. - AudiobookshelfApiProvider call( - Uri? baseUrl, - ) { - return AudiobookshelfApiProvider( - baseUrl, - ); + AudiobookshelfApiProvider._({ + required AudiobookshelfApiFamily super.from, + required Uri? super.argument, + }) : super( + retry: null, + name: r'audiobookshelfApiProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$audiobookshelfApiHash(); + + @override + String toString() { + return r'audiobookshelfApiProvider' + '' + '($argument)'; } + @$internal @override - AudiobookshelfApiProvider getProviderOverride( - covariant AudiobookshelfApiProvider provider, - ) { - return call( - provider.baseUrl, - ); + $ProviderElement $createElement( + $ProviderPointer pointer, + ) => $ProviderElement(pointer); + + @override + AudiobookshelfApi create(Ref ref) { + final argument = this.argument as Uri?; + return audiobookshelfApi(ref, argument); } - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'audiobookshelfApiProvider'; -} - -/// get the api instance for the given base url -/// -/// Copied from [audiobookshelfApi]. -class AudiobookshelfApiProvider extends AutoDisposeProvider { - /// get the api instance for the given base url - /// - /// Copied from [audiobookshelfApi]. - AudiobookshelfApiProvider( - Uri? baseUrl, - ) : this._internal( - (ref) => audiobookshelfApi( - ref as AudiobookshelfApiRef, - baseUrl, - ), - from: audiobookshelfApiProvider, - name: r'audiobookshelfApiProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$audiobookshelfApiHash, - dependencies: AudiobookshelfApiFamily._dependencies, - allTransitiveDependencies: - AudiobookshelfApiFamily._allTransitiveDependencies, - baseUrl: baseUrl, - ); - - AudiobookshelfApiProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.baseUrl, - }) : super.internal(); - - final Uri? baseUrl; - - @override - Override overrideWith( - AudiobookshelfApi Function(AudiobookshelfApiRef provider) create, - ) { - return ProviderOverride( + /// {@macro riverpod.override_with_value} + Override overrideWithValue(AudiobookshelfApi value) { + return $ProviderOverride( origin: this, - override: AudiobookshelfApiProvider._internal( - (ref) => create(ref as AudiobookshelfApiRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - baseUrl: baseUrl, - ), + providerOverride: $SyncValueProvider(value), ); } - @override - AutoDisposeProviderElement createElement() { - return _AudiobookshelfApiProviderElement(this); - } - @override bool operator ==(Object other) { - return other is AudiobookshelfApiProvider && other.baseUrl == baseUrl; + return other is AudiobookshelfApiProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, baseUrl.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AudiobookshelfApiRef on AutoDisposeProviderRef { - /// The parameter `baseUrl` of this provider. - Uri? get baseUrl; -} +String _$audiobookshelfApiHash() => r'f23a06c404e11867a7f796877eaca99b8ff25458'; -class _AudiobookshelfApiProviderElement - extends AutoDisposeProviderElement - with AudiobookshelfApiRef { - _AudiobookshelfApiProviderElement(super.provider); +/// get the api instance for the given base url + +final class AudiobookshelfApiFamily extends $Family + with $FunctionalFamilyOverride { + AudiobookshelfApiFamily._() + : super( + retry: null, + name: r'audiobookshelfApiProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + /// get the api instance for the given base url + + AudiobookshelfApiProvider call(Uri? baseUrl) => + AudiobookshelfApiProvider._(argument: baseUrl, from: this); @override - Uri? get baseUrl => (origin as AudiobookshelfApiProvider).baseUrl; + String toString() => r'audiobookshelfApiProvider'; } -String _$authenticatedApiHash() => r'284be2c39823c20fb70035a136c430862c28fa27'; - /// get the api instance for the authenticated user /// /// if the user is not authenticated throw an error -/// -/// Copied from [authenticatedApi]. + @ProviderFor(authenticatedApi) -final authenticatedApiProvider = Provider.internal( - authenticatedApi, - name: r'authenticatedApiProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$authenticatedApiHash, - dependencies: null, - allTransitiveDependencies: null, -); +final authenticatedApiProvider = AuthenticatedApiProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef AuthenticatedApiRef = ProviderRef; -String _$isServerAliveHash() => r'bb3a53cae1eb64b8760a56864feed47b7a3f1c29'; - -/// ping the server to check if it is reachable +/// get the api instance for the authenticated user /// -/// Copied from [isServerAlive]. -@ProviderFor(isServerAlive) -const isServerAliveProvider = IsServerAliveFamily(); +/// if the user is not authenticated throw an error -/// ping the server to check if it is reachable -/// -/// Copied from [isServerAlive]. -class IsServerAliveFamily extends Family> { - /// ping the server to check if it is reachable +final class AuthenticatedApiProvider + extends + $FunctionalProvider< + AudiobookshelfApi, + AudiobookshelfApi, + AudiobookshelfApi + > + with $Provider { + /// get the api instance for the authenticated user /// - /// Copied from [isServerAlive]. - const IsServerAliveFamily(); + /// if the user is not authenticated throw an error + AuthenticatedApiProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'authenticatedApiProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// ping the server to check if it is reachable - /// - /// Copied from [isServerAlive]. - IsServerAliveProvider call( - String address, - ) { - return IsServerAliveProvider( - address, - ); + @override + String debugGetCreateSourceHash() => _$authenticatedApiHash(); + + @$internal + @override + $ProviderElement $createElement( + $ProviderPointer pointer, + ) => $ProviderElement(pointer); + + @override + AudiobookshelfApi create(Ref ref) { + return authenticatedApi(ref); } - @override - IsServerAliveProvider getProviderOverride( - covariant IsServerAliveProvider provider, - ) { - return call( - provider.address, + /// {@macro riverpod.override_with_value} + Override overrideWithValue(AudiobookshelfApi value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), ); } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'isServerAliveProvider'; } +String _$authenticatedApiHash() => r'284be2c39823c20fb70035a136c430862c28fa27'; + /// ping the server to check if it is reachable -/// -/// Copied from [isServerAlive]. -class IsServerAliveProvider extends AutoDisposeFutureProvider { + +@ProviderFor(isServerAlive) +final isServerAliveProvider = IsServerAliveFamily._(); + +/// ping the server to check if it is reachable + +final class IsServerAliveProvider + extends $FunctionalProvider, bool, FutureOr> + with $FutureModifier, $FutureProvider { /// ping the server to check if it is reachable - /// - /// Copied from [isServerAlive]. - IsServerAliveProvider( - String address, - ) : this._internal( - (ref) => isServerAlive( - ref as IsServerAliveRef, - address, - ), - from: isServerAliveProvider, - name: r'isServerAliveProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$isServerAliveHash, - dependencies: IsServerAliveFamily._dependencies, - allTransitiveDependencies: - IsServerAliveFamily._allTransitiveDependencies, - address: address, - ); - - IsServerAliveProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.address, - }) : super.internal(); - - final String address; + IsServerAliveProvider._({ + required IsServerAliveFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'isServerAliveProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - Override overrideWith( - FutureOr Function(IsServerAliveRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: IsServerAliveProvider._internal( - (ref) => create(ref as IsServerAliveRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - address: address, - ), - ); + String debugGetCreateSourceHash() => _$isServerAliveHash(); + + @override + String toString() { + return r'isServerAliveProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _IsServerAliveProviderElement(this); + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return isServerAlive(ref, argument); } @override bool operator ==(Object other) { - return other is IsServerAliveProvider && other.address == address; + return other is IsServerAliveProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, address.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin IsServerAliveRef on AutoDisposeFutureProviderRef { - /// The parameter `address` of this provider. - String get address; -} +String _$isServerAliveHash() => r'bb3a53cae1eb64b8760a56864feed47b7a3f1c29'; -class _IsServerAliveProviderElement - extends AutoDisposeFutureProviderElement with IsServerAliveRef { - _IsServerAliveProviderElement(super.provider); +/// ping the server to check if it is reachable + +final class IsServerAliveFamily extends $Family + with $FunctionalFamilyOverride, String> { + IsServerAliveFamily._() + : super( + retry: null, + name: r'isServerAliveProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + /// ping the server to check if it is reachable + + IsServerAliveProvider call(String address) => + IsServerAliveProvider._(argument: address, from: this); @override - String get address => (origin as IsServerAliveProvider).address; + String toString() => r'isServerAliveProvider'; +} + +/// fetch status of server + +@ProviderFor(serverStatus) +final serverStatusProvider = ServerStatusFamily._(); + +/// fetch status of server + +final class ServerStatusProvider + extends + $FunctionalProvider< + AsyncValue, + ServerStatusResponse?, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + /// fetch status of server + ServerStatusProvider._({ + required ServerStatusFamily super.from, + required (Uri, ResponseErrorHandler?) super.argument, + }) : super( + retry: null, + name: r'serverStatusProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$serverStatusHash(); + + @override + String toString() { + return r'serverStatusProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as (Uri, ResponseErrorHandler?); + return serverStatus(ref, argument.$1, argument.$2); + } + + @override + bool operator ==(Object other) { + return other is ServerStatusProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$serverStatusHash() => r'2d9c5d6f970caec555e5322d43a388ea8572619f'; /// fetch status of server -/// -/// Copied from [serverStatus]. -@ProviderFor(serverStatus) -const serverStatusProvider = ServerStatusFamily(); -/// fetch status of server -/// -/// Copied from [serverStatus]. -class ServerStatusFamily extends Family> { - /// fetch status of server - /// - /// Copied from [serverStatus]. - const ServerStatusFamily(); +final class ServerStatusFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (Uri, ResponseErrorHandler?) + > { + ServerStatusFamily._() + : super( + retry: null, + name: r'serverStatusProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); /// fetch status of server - /// - /// Copied from [serverStatus]. + ServerStatusProvider call( Uri baseUrl, [ - void Function(Response, [Object?])? responseErrorHandler, - ]) { - return ServerStatusProvider( - baseUrl, - responseErrorHandler, - ); - } + ResponseErrorHandler? responseErrorHandler, + ]) => ServerStatusProvider._( + argument: (baseUrl, responseErrorHandler), + from: this, + ); @override - ServerStatusProvider getProviderOverride( - covariant ServerStatusProvider provider, - ) { - return call( - provider.baseUrl, - provider.responseErrorHandler, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'serverStatusProvider'; + String toString() => r'serverStatusProvider'; } -/// fetch status of server -/// -/// Copied from [serverStatus]. -class ServerStatusProvider - extends AutoDisposeFutureProvider { - /// fetch status of server - /// - /// Copied from [serverStatus]. - ServerStatusProvider( - Uri baseUrl, [ - void Function(Response, [Object?])? responseErrorHandler, - ]) : this._internal( - (ref) => serverStatus( - ref as ServerStatusRef, - baseUrl, - responseErrorHandler, - ), - from: serverStatusProvider, - name: r'serverStatusProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$serverStatusHash, - dependencies: ServerStatusFamily._dependencies, - allTransitiveDependencies: - ServerStatusFamily._allTransitiveDependencies, - baseUrl: baseUrl, - responseErrorHandler: responseErrorHandler, - ); +/// fetch the personalized view - ServerStatusProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.baseUrl, - required this.responseErrorHandler, - }) : super.internal(); +@ProviderFor(PersonalizedView) +final personalizedViewProvider = PersonalizedViewProvider._(); - final Uri baseUrl; - final void Function(Response, [Object?])? responseErrorHandler; - - @override - Override overrideWith( - FutureOr Function(ServerStatusRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: ServerStatusProvider._internal( - (ref) => create(ref as ServerStatusRef), - from: from, - name: null, +/// fetch the personalized view +final class PersonalizedViewProvider + extends $StreamNotifierProvider> { + /// fetch the personalized view + PersonalizedViewProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'personalizedViewProvider', + isAutoDispose: true, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - baseUrl: baseUrl, - responseErrorHandler: responseErrorHandler, - ), - ); - } + $allTransitiveDependencies: null, + ); @override - AutoDisposeFutureProviderElement createElement() { - return _ServerStatusProviderElement(this); - } + String debugGetCreateSourceHash() => _$personalizedViewHash(); + @$internal @override - bool operator ==(Object other) { - return other is ServerStatusProvider && - other.baseUrl == baseUrl && - other.responseErrorHandler == responseErrorHandler; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, baseUrl.hashCode); - hash = _SystemHash.combine(hash, responseErrorHandler.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ServerStatusRef on AutoDisposeFutureProviderRef { - /// The parameter `baseUrl` of this provider. - Uri get baseUrl; - - /// The parameter `responseErrorHandler` of this provider. - void Function(Response, [Object?])? get responseErrorHandler; -} - -class _ServerStatusProviderElement - extends AutoDisposeFutureProviderElement - with ServerStatusRef { - _ServerStatusProviderElement(super.provider); - - @override - Uri get baseUrl => (origin as ServerStatusProvider).baseUrl; - @override - void Function(Response, [Object?])? get responseErrorHandler => - (origin as ServerStatusProvider).responseErrorHandler; -} - -String _$fetchContinueListeningHash() => - r'50aeb77369eda38d496b2f56f3df2aea135dab45'; - -/// fetch continue listening audiobooks -/// -/// Copied from [fetchContinueListening]. -@ProviderFor(fetchContinueListening) -final fetchContinueListeningProvider = - AutoDisposeFutureProvider.internal( - fetchContinueListening, - name: r'fetchContinueListeningProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$fetchContinueListeningHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef FetchContinueListeningRef - = AutoDisposeFutureProviderRef; -String _$meHash() => r'b3b6d6d940b465c60d0c29cd6e81ba2fcccab186'; - -/// See also [me]. -@ProviderFor(me) -final meProvider = AutoDisposeFutureProvider.internal( - me, - name: r'meProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$meHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef MeRef = AutoDisposeFutureProviderRef; -String _$loginHash() => r'99410c2bed9c8f412c7b47c4e655db64e0054be2'; - -/// See also [login]. -@ProviderFor(login) -const loginProvider = LoginFamily(); - -/// See also [login]. -class LoginFamily extends Family> { - /// See also [login]. - const LoginFamily(); - - /// See also [login]. - LoginProvider call({ - AuthenticatedUser? user, - }) { - return LoginProvider( - user: user, - ); - } - - @override - LoginProvider getProviderOverride( - covariant LoginProvider provider, - ) { - return call( - user: provider.user, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'loginProvider'; -} - -/// See also [login]. -class LoginProvider extends AutoDisposeFutureProvider { - /// See also [login]. - LoginProvider({ - AuthenticatedUser? user, - }) : this._internal( - (ref) => login( - ref as LoginRef, - user: user, - ), - from: loginProvider, - name: r'loginProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$loginHash, - dependencies: LoginFamily._dependencies, - allTransitiveDependencies: LoginFamily._allTransitiveDependencies, - user: user, - ); - - LoginProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.user, - }) : super.internal(); - - final AuthenticatedUser? user; - - @override - Override overrideWith( - FutureOr Function(LoginRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: LoginProvider._internal( - (ref) => create(ref as LoginRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - user: user, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _LoginProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is LoginProvider && other.user == user; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, user.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LoginRef on AutoDisposeFutureProviderRef { - /// The parameter `user` of this provider. - AuthenticatedUser? get user; -} - -class _LoginProviderElement - extends AutoDisposeFutureProviderElement with LoginRef { - _LoginProviderElement(super.provider); - - @override - AuthenticatedUser? get user => (origin as LoginProvider).user; + PersonalizedView create() => PersonalizedView(); } String _$personalizedViewHash() => r'425e89d99d7e4712b4d6a688f3a12442bd66584f'; /// fetch the personalized view -/// -/// Copied from [PersonalizedView]. -@ProviderFor(PersonalizedView) -final personalizedViewProvider = - AutoDisposeStreamNotifierProvider>.internal( - PersonalizedView.new, - name: r'personalizedViewProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$personalizedViewHash, - dependencies: null, - allTransitiveDependencies: null, -); -typedef _$PersonalizedView = AutoDisposeStreamNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$PersonalizedView extends $StreamNotifier> { + Stream> build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier>, List>, + AsyncValue>, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} + +/// fetch continue listening audiobooks + +@ProviderFor(fetchContinueListening) +final fetchContinueListeningProvider = FetchContinueListeningProvider._(); + +/// fetch continue listening audiobooks + +final class FetchContinueListeningProvider + extends + $FunctionalProvider< + AsyncValue, + GetUserSessionsResponse, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + /// fetch continue listening audiobooks + FetchContinueListeningProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'fetchContinueListeningProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$fetchContinueListeningHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return fetchContinueListening(ref); + } +} + +String _$fetchContinueListeningHash() => + r'50aeb77369eda38d496b2f56f3df2aea135dab45'; + +@ProviderFor(me) +final meProvider = MeProvider._(); + +final class MeProvider + extends $FunctionalProvider, User, FutureOr> + with $FutureModifier, $FutureProvider { + MeProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'meProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$meHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return me(ref); + } +} + +String _$meHash() => r'b3b6d6d940b465c60d0c29cd6e81ba2fcccab186'; + +@ProviderFor(login) +final loginProvider = LoginFamily._(); + +final class LoginProvider + extends + $FunctionalProvider< + AsyncValue, + LoginResponse?, + FutureOr + > + with $FutureModifier, $FutureProvider { + LoginProvider._({ + required LoginFamily super.from, + required AuthenticatedUser? super.argument, + }) : super( + retry: null, + name: r'loginProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$loginHash(); + + @override + String toString() { + return r'loginProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as AuthenticatedUser?; + return login(ref, user: argument); + } + + @override + bool operator ==(Object other) { + return other is LoginProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } +} + +String _$loginHash() => r'99410c2bed9c8f412c7b47c4e655db64e0054be2'; + +final class LoginFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + AuthenticatedUser? + > { + LoginFamily._() + : super( + retry: null, + name: r'loginProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + LoginProvider call({AuthenticatedUser? user}) => + LoginProvider._(argument: user, from: this); + + @override + String toString() => r'loginProvider'; +} diff --git a/lib/api/authenticated_users_provider.dart b/lib/api/authenticated_users_provider.dart index 5e78fab..7f74ae4 100644 --- a/lib/api/authenticated_users_provider.dart +++ b/lib/api/authenticated_users_provider.dart @@ -19,7 +19,7 @@ final _logger = Logger('authenticated_users_provider'); class AuthenticatedUsers extends _$AuthenticatedUsers { @override Set build() { - ref.listenSelf((_, __) { + listenSelf((_, __) { writeStateToBox(); }); // get the app settings diff --git a/lib/api/authenticated_users_provider.g.dart b/lib/api/authenticated_users_provider.g.dart index 44a2610..8e3021f 100644 --- a/lib/api/authenticated_users_provider.g.dart +++ b/lib/api/authenticated_users_provider.g.dart @@ -6,25 +6,70 @@ part of 'authenticated_users_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$authenticatedUsersHash() => - r'5fdd472f62fc3b73ff8417cdce9f02e86c33d00f'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning +/// provides with a set of authenticated users + +@ProviderFor(AuthenticatedUsers) +final authenticatedUsersProvider = AuthenticatedUsersProvider._(); /// provides with a set of authenticated users -/// -/// Copied from [AuthenticatedUsers]. -@ProviderFor(AuthenticatedUsers) -final authenticatedUsersProvider = AutoDisposeNotifierProvider< - AuthenticatedUsers, Set>.internal( - AuthenticatedUsers.new, - name: r'authenticatedUsersProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$authenticatedUsersHash, - dependencies: null, - allTransitiveDependencies: null, -); +final class AuthenticatedUsersProvider + extends + $NotifierProvider> { + /// provides with a set of authenticated users + AuthenticatedUsersProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'authenticatedUsersProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); -typedef _$AuthenticatedUsers - = AutoDisposeNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package + @override + String debugGetCreateSourceHash() => _$authenticatedUsersHash(); + + @$internal + @override + AuthenticatedUsers create() => AuthenticatedUsers(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Set value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>(value), + ); + } +} + +String _$authenticatedUsersHash() => + r'c5e82cc70ffc31a0d315e3db9e07a141c583471e'; + +/// provides with a set of authenticated users + +abstract class _$AuthenticatedUsers + extends $Notifier> { + Set build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref, Set>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + Set, + Set + >, + Set, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/api/image_provider.g.dart b/lib/api/image_provider.g.dart index 25f94d6..02ccad8 100644 --- a/lib/api/image_provider.g.dart +++ b/lib/api/image_provider.g.dart @@ -6,169 +6,94 @@ part of 'image_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$coverImageHash() => r'89cc4783cbc76bb41beae34384d92fb277135c75'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$CoverImage extends BuildlessStreamNotifier { - late final String itemId; - - Stream build( - String itemId, - ); -} - -/// See also [CoverImage]. @ProviderFor(CoverImage) -const coverImageProvider = CoverImageFamily(); +final coverImageProvider = CoverImageFamily._(); -/// See also [CoverImage]. -class CoverImageFamily extends Family> { - /// See also [CoverImage]. - const CoverImageFamily(); +final class CoverImageProvider + extends $StreamNotifierProvider { + CoverImageProvider._({ + required CoverImageFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'coverImageProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [CoverImage]. - CoverImageProvider call( - String itemId, - ) { - return CoverImageProvider( - itemId, - ); + @override + String debugGetCreateSourceHash() => _$coverImageHash(); + + @override + String toString() { + return r'coverImageProvider' + '' + '($argument)'; } + @$internal @override - CoverImageProvider getProviderOverride( - covariant CoverImageProvider provider, - ) { - return call( - provider.itemId, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'coverImageProvider'; -} - -/// See also [CoverImage]. -class CoverImageProvider - extends StreamNotifierProviderImpl { - /// See also [CoverImage]. - CoverImageProvider( - String itemId, - ) : this._internal( - () => CoverImage()..itemId = itemId, - from: coverImageProvider, - name: r'coverImageProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$coverImageHash, - dependencies: CoverImageFamily._dependencies, - allTransitiveDependencies: - CoverImageFamily._allTransitiveDependencies, - itemId: itemId, - ); - - CoverImageProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.itemId, - }) : super.internal(); - - final String itemId; - - @override - Stream runNotifierBuild( - covariant CoverImage notifier, - ) { - return notifier.build( - itemId, - ); - } - - @override - Override overrideWith(CoverImage Function() create) { - return ProviderOverride( - origin: this, - override: CoverImageProvider._internal( - () => create()..itemId = itemId, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - itemId: itemId, - ), - ); - } - - @override - StreamNotifierProviderElement createElement() { - return _CoverImageProviderElement(this); - } + CoverImage create() => CoverImage(); @override bool operator ==(Object other) { - return other is CoverImageProvider && other.itemId == itemId; + return other is CoverImageProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, itemId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin CoverImageRef on StreamNotifierProviderRef { - /// The parameter `itemId` of this provider. - String get itemId; -} +String _$coverImageHash() => r'89cc4783cbc76bb41beae34384d92fb277135c75'; -class _CoverImageProviderElement - extends StreamNotifierProviderElement - with CoverImageRef { - _CoverImageProviderElement(super.provider); +final class CoverImageFamily extends $Family + with + $ClassFamilyOverride< + CoverImage, + AsyncValue, + Uint8List, + Stream, + String + > { + CoverImageFamily._() + : super( + retry: null, + name: r'coverImageProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: false, + ); + + CoverImageProvider call(String itemId) => + CoverImageProvider._(argument: itemId, from: this); @override - String get itemId => (origin as CoverImageProvider).itemId; + String toString() => r'coverImageProvider'; +} + +abstract class _$CoverImage extends $StreamNotifier { + late final _$args = ref.$arg as String; + String get itemId => _$args; + + Stream build(String itemId); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref, Uint8List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, Uint8List>, + AsyncValue, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/api/library_item_provider.g.dart b/lib/api/library_item_provider.g.dart index 5261d9c..df8fe0e 100644 --- a/lib/api/library_item_provider.g.dart +++ b/lib/api/library_item_provider.g.dart @@ -6,184 +6,112 @@ part of 'library_item_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$libraryItemHash() => r'a3cfa7f912e9498a70b5782899018b6964d6445c'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$LibraryItem - extends BuildlessStreamNotifier { - late final String id; - - Stream build( - String id, - ); -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// provides the library item for the given id -/// -/// Copied from [LibraryItem]. + @ProviderFor(LibraryItem) -const libraryItemProvider = LibraryItemFamily(); +final libraryItemProvider = LibraryItemFamily._(); /// provides the library item for the given id -/// -/// Copied from [LibraryItem]. -class LibraryItemFamily - extends Family> { +final class LibraryItemProvider + extends $StreamNotifierProvider { /// provides the library item for the given id - /// - /// Copied from [LibraryItem]. - const LibraryItemFamily(); + LibraryItemProvider._({ + required LibraryItemFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'libraryItemProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// provides the library item for the given id - /// - /// Copied from [LibraryItem]. - LibraryItemProvider call( - String id, - ) { - return LibraryItemProvider( - id, - ); + @override + String debugGetCreateSourceHash() => _$libraryItemHash(); + + @override + String toString() { + return r'libraryItemProvider' + '' + '($argument)'; } + @$internal @override - LibraryItemProvider getProviderOverride( - covariant LibraryItemProvider provider, - ) { - return call( - provider.id, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'libraryItemProvider'; -} - -/// provides the library item for the given id -/// -/// Copied from [LibraryItem]. -class LibraryItemProvider extends StreamNotifierProviderImpl { - /// provides the library item for the given id - /// - /// Copied from [LibraryItem]. - LibraryItemProvider( - String id, - ) : this._internal( - () => LibraryItem()..id = id, - from: libraryItemProvider, - name: r'libraryItemProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$libraryItemHash, - dependencies: LibraryItemFamily._dependencies, - allTransitiveDependencies: - LibraryItemFamily._allTransitiveDependencies, - id: id, - ); - - LibraryItemProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - Stream runNotifierBuild( - covariant LibraryItem notifier, - ) { - return notifier.build( - id, - ); - } - - @override - Override overrideWith(LibraryItem Function() create) { - return ProviderOverride( - origin: this, - override: LibraryItemProvider._internal( - () => create()..id = id, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - StreamNotifierProviderElement - createElement() { - return _LibraryItemProviderElement(this); - } + LibraryItem create() => LibraryItem(); @override bool operator ==(Object other) { - return other is LibraryItemProvider && other.id == id; + return other is LibraryItemProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LibraryItemRef - on StreamNotifierProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$libraryItemHash() => r'a3cfa7f912e9498a70b5782899018b6964d6445c'; -class _LibraryItemProviderElement extends StreamNotifierProviderElement< - LibraryItem, shelfsdk.LibraryItemExpanded> with LibraryItemRef { - _LibraryItemProviderElement(super.provider); +/// provides the library item for the given id + +final class LibraryItemFamily extends $Family + with + $ClassFamilyOverride< + LibraryItem, + AsyncValue, + shelfsdk.LibraryItemExpanded, + Stream, + String + > { + LibraryItemFamily._() + : super( + retry: null, + name: r'libraryItemProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: false, + ); + + /// provides the library item for the given id + + LibraryItemProvider call(String id) => + LibraryItemProvider._(argument: id, from: this); @override - String get id => (origin as LibraryItemProvider).id; + String toString() => r'libraryItemProvider'; +} + +/// provides the library item for the given id + +abstract class _$LibraryItem + extends $StreamNotifier { + late final _$args = ref.$arg as String; + String get id => _$args; + + Stream build(String id); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref< + AsyncValue, + shelfsdk.LibraryItemExpanded + >; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + AsyncValue, + shelfsdk.LibraryItemExpanded + >, + AsyncValue, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/api/library_provider.dart b/lib/api/library_provider.dart index 62c79d8..b565d26 100644 --- a/lib/api/library_provider.dart +++ b/lib/api/library_provider.dart @@ -1,4 +1,5 @@ -import 'package:hooks_riverpod/hooks_riverpod.dart' show Ref; +import 'package:hooks_riverpod/hooks_riverpod.dart' + show Ref, ProviderListenableSelect; import 'package:logging/logging.dart' show Logger; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/api/library_provider.g.dart b/lib/api/library_provider.g.dart index a8bc88a..df8fbfd 100644 --- a/lib/api/library_provider.g.dart +++ b/lib/api/library_provider.g.dart @@ -6,187 +6,153 @@ part of 'library_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$libraryHash() => r'f8a34100acb58f02fa958c71a629577bf815710e'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [library]. @ProviderFor(library) -const libraryProvider = LibraryFamily(); +final libraryProvider = LibraryFamily._(); -/// See also [library]. -class LibraryFamily extends Family> { - /// See also [library]. - const LibraryFamily(); +final class LibraryProvider + extends + $FunctionalProvider, Library?, FutureOr> + with $FutureModifier, $FutureProvider { + LibraryProvider._({ + required LibraryFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'libraryProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [library]. - LibraryProvider call( - String id, - ) { - return LibraryProvider( - id, - ); + @override + String debugGetCreateSourceHash() => _$libraryHash(); + + @override + String toString() { + return r'libraryProvider' + '' + '($argument)'; } + @$internal @override - LibraryProvider getProviderOverride( - covariant LibraryProvider provider, - ) { - return call( - provider.id, - ); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'libraryProvider'; -} - -/// See also [library]. -class LibraryProvider extends AutoDisposeFutureProvider { - /// See also [library]. - LibraryProvider( - String id, - ) : this._internal( - (ref) => library( - ref as LibraryRef, - id, - ), - from: libraryProvider, - name: r'libraryProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$libraryHash, - dependencies: LibraryFamily._dependencies, - allTransitiveDependencies: LibraryFamily._allTransitiveDependencies, - id: id, - ); - - LibraryProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - Override overrideWith( - FutureOr Function(LibraryRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: LibraryProvider._internal( - (ref) => create(ref as LibraryRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _LibraryProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return library(ref, argument); } @override bool operator ==(Object other) { - return other is LibraryProvider && other.id == id; + return other is LibraryProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LibraryRef on AutoDisposeFutureProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$libraryHash() => r'f8a34100acb58f02fa958c71a629577bf815710e'; -class _LibraryProviderElement extends AutoDisposeFutureProviderElement - with LibraryRef { - _LibraryProviderElement(super.provider); +final class LibraryFamily extends $Family + with $FunctionalFamilyOverride, String> { + LibraryFamily._() + : super( + retry: null, + name: r'libraryProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + LibraryProvider call(String id) => + LibraryProvider._(argument: id, from: this); @override - String get id => (origin as LibraryProvider).id; + String toString() => r'libraryProvider'; +} + +@ProviderFor(currentLibrary) +final currentLibraryProvider = CurrentLibraryProvider._(); + +final class CurrentLibraryProvider + extends + $FunctionalProvider, Library?, FutureOr> + with $FutureModifier, $FutureProvider { + CurrentLibraryProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'currentLibraryProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$currentLibraryHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return currentLibrary(ref); + } } String _$currentLibraryHash() => r'658498a531e04a01e2b3915a3319101285601118'; -/// See also [currentLibrary]. -@ProviderFor(currentLibrary) -final currentLibraryProvider = AutoDisposeFutureProvider.internal( - currentLibrary, - name: r'currentLibraryProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$currentLibraryHash, - dependencies: null, - allTransitiveDependencies: null, -); +@ProviderFor(Libraries) +final librariesProvider = LibrariesProvider._(); + +final class LibrariesProvider + extends $AsyncNotifierProvider> { + LibrariesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'librariesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$librariesHash(); + + @$internal + @override + Libraries create() => Libraries(); +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CurrentLibraryRef = AutoDisposeFutureProviderRef; String _$librariesHash() => r'95ebd4d1ac0cc2acf7617dc22895eff0ca30600f'; -/// See also [Libraries]. -@ProviderFor(Libraries) -final librariesProvider = - AutoDisposeAsyncNotifierProvider>.internal( - Libraries.new, - name: r'librariesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$librariesHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$Libraries = AutoDisposeAsyncNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$Libraries extends $AsyncNotifier> { + FutureOr> build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier>, List>, + AsyncValue>, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/api/server_provider.dart b/lib/api/server_provider.dart index ef1c864..690dcc4 100644 --- a/lib/api/server_provider.dart +++ b/lib/api/server_provider.dart @@ -28,7 +28,7 @@ class ServerAlreadyExistsException implements Exception { class AudiobookShelfServer extends _$AudiobookShelfServer { @override Set build() { - ref.listenSelf((_, __) { + listenSelf((_, __) { writeStateToBox(); }); // get the app settings diff --git a/lib/api/server_provider.g.dart b/lib/api/server_provider.g.dart index ff2406a..16eddd0 100644 --- a/lib/api/server_provider.g.dart +++ b/lib/api/server_provider.g.dart @@ -6,25 +6,78 @@ part of 'server_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$audiobookShelfServerHash() => - r'31a96b431221965cd586aad670a32ca901539e41'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning +/// provides with a set of servers added by the user + +@ProviderFor(AudiobookShelfServer) +final audiobookShelfServerProvider = AudiobookShelfServerProvider._(); /// provides with a set of servers added by the user -/// -/// Copied from [AudiobookShelfServer]. -@ProviderFor(AudiobookShelfServer) -final audiobookShelfServerProvider = AutoDisposeNotifierProvider< - AudiobookShelfServer, Set>.internal( - AudiobookShelfServer.new, - name: r'audiobookShelfServerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$audiobookShelfServerHash, - dependencies: null, - allTransitiveDependencies: null, -); +final class AudiobookShelfServerProvider + extends + $NotifierProvider< + AudiobookShelfServer, + Set + > { + /// provides with a set of servers added by the user + AudiobookShelfServerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'audiobookShelfServerProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); -typedef _$AudiobookShelfServer - = AutoDisposeNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package + @override + String debugGetCreateSourceHash() => _$audiobookShelfServerHash(); + + @$internal + @override + AudiobookShelfServer create() => AudiobookShelfServer(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Set value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>( + value, + ), + ); + } +} + +String _$audiobookShelfServerHash() => + r'144817dcb3704b80c5b60763167fcf932f00c29c'; + +/// provides with a set of servers added by the user + +abstract class _$AudiobookShelfServer + extends $Notifier> { + Set build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref< + Set, + Set + >; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + Set, + Set + >, + Set, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/db/available_boxes.dart b/lib/db/available_boxes.dart index ff01acc..dc2d5a1 100644 --- a/lib/db/available_boxes.dart +++ b/lib/db/available_boxes.dart @@ -1,5 +1,5 @@ import 'package:flutter/foundation.dart' show immutable; -import 'package:hive/hive.dart'; +import 'package:hive_plus_secure/hive_plus_secure.dart'; import 'package:vaani/features/per_book_settings/models/book_settings.dart'; import 'package:vaani/settings/models/models.dart'; diff --git a/lib/db/cache/schemas/image.g.dart b/lib/db/cache/schemas/image.g.dart deleted file mode 100644 index 555ce5e..0000000 --- a/lib/db/cache/schemas/image.g.dart +++ /dev/null @@ -1,1009 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'image.dart'; - -// ************************************************************************** -// _IsarCollectionGenerator -// ************************************************************************** - -// coverage:ignore-file -// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors -// ignore_for_file: type=lint - -extension GetImageCollection on Isar { - IsarCollection get images => this.collection(); -} - -const ImageSchema = IsarGeneratedSchema( - schema: IsarSchema( - name: 'CacheImage', - idName: 'id', - embedded: false, - properties: [ - IsarPropertySchema( - name: 'thumbnailPath', - type: IsarType.string, - ), - IsarPropertySchema( - name: 'imagePath', - type: IsarType.string, - ), - IsarPropertySchema( - name: 'lastSaved', - type: IsarType.dateTime, - ), - ], - indexes: [], - ), - converter: IsarObjectConverter( - serialize: serializeImage, - deserialize: deserializeImage, - deserializeProperty: deserializeImageProp, - ), - embeddedSchemas: [], -); - -@isarProtected -int serializeImage(IsarWriter writer, Image object) { - { - final value = object.thumbnailPath; - if (value == null) { - IsarCore.writeNull(writer, 1); - } else { - IsarCore.writeString(writer, 1, value); - } - } - { - final value = object.imagePath; - if (value == null) { - IsarCore.writeNull(writer, 2); - } else { - IsarCore.writeString(writer, 2, value); - } - } - IsarCore.writeLong( - writer, 3, object.lastSaved.toUtc().microsecondsSinceEpoch); - return object.id; -} - -@isarProtected -Image deserializeImage(IsarReader reader) { - final int _id; - _id = IsarCore.readId(reader); - final String? _thumbnailPath; - _thumbnailPath = IsarCore.readString(reader, 1); - final String? _imagePath; - _imagePath = IsarCore.readString(reader, 2); - final object = Image( - id: _id, - thumbnailPath: _thumbnailPath, - imagePath: _imagePath, - ); - { - final value = IsarCore.readLong(reader, 3); - if (value == -9223372036854775808) { - object.lastSaved = - DateTime.fromMillisecondsSinceEpoch(0, isUtc: true).toLocal(); - } else { - object.lastSaved = - DateTime.fromMicrosecondsSinceEpoch(value, isUtc: true).toLocal(); - } - } - return object; -} - -@isarProtected -dynamic deserializeImageProp(IsarReader reader, int property) { - switch (property) { - case 0: - return IsarCore.readId(reader); - case 1: - return IsarCore.readString(reader, 1); - case 2: - return IsarCore.readString(reader, 2); - case 3: - { - final value = IsarCore.readLong(reader, 3); - if (value == -9223372036854775808) { - return DateTime.fromMillisecondsSinceEpoch(0, isUtc: true).toLocal(); - } else { - return DateTime.fromMicrosecondsSinceEpoch(value, isUtc: true) - .toLocal(); - } - } - default: - throw ArgumentError('Unknown property: $property'); - } -} - -sealed class _ImageUpdate { - bool call({ - required int id, - String? thumbnailPath, - String? imagePath, - DateTime? lastSaved, - }); -} - -class _ImageUpdateImpl implements _ImageUpdate { - const _ImageUpdateImpl(this.collection); - - final IsarCollection collection; - - @override - bool call({ - required int id, - Object? thumbnailPath = ignore, - Object? imagePath = ignore, - Object? lastSaved = ignore, - }) { - return collection.updateProperties([ - id - ], { - if (thumbnailPath != ignore) 1: thumbnailPath as String?, - if (imagePath != ignore) 2: imagePath as String?, - if (lastSaved != ignore) 3: lastSaved as DateTime?, - }) > - 0; - } -} - -sealed class _ImageUpdateAll { - int call({ - required List id, - String? thumbnailPath, - String? imagePath, - DateTime? lastSaved, - }); -} - -class _ImageUpdateAllImpl implements _ImageUpdateAll { - const _ImageUpdateAllImpl(this.collection); - - final IsarCollection collection; - - @override - int call({ - required List id, - Object? thumbnailPath = ignore, - Object? imagePath = ignore, - Object? lastSaved = ignore, - }) { - return collection.updateProperties(id, { - if (thumbnailPath != ignore) 1: thumbnailPath as String?, - if (imagePath != ignore) 2: imagePath as String?, - if (lastSaved != ignore) 3: lastSaved as DateTime?, - }); - } -} - -extension ImageUpdate on IsarCollection { - _ImageUpdate get update => _ImageUpdateImpl(this); - - _ImageUpdateAll get updateAll => _ImageUpdateAllImpl(this); -} - -sealed class _ImageQueryUpdate { - int call({ - String? thumbnailPath, - String? imagePath, - DateTime? lastSaved, - }); -} - -class _ImageQueryUpdateImpl implements _ImageQueryUpdate { - const _ImageQueryUpdateImpl(this.query, {this.limit}); - - final IsarQuery query; - final int? limit; - - @override - int call({ - Object? thumbnailPath = ignore, - Object? imagePath = ignore, - Object? lastSaved = ignore, - }) { - return query.updateProperties(limit: limit, { - if (thumbnailPath != ignore) 1: thumbnailPath as String?, - if (imagePath != ignore) 2: imagePath as String?, - if (lastSaved != ignore) 3: lastSaved as DateTime?, - }); - } -} - -extension ImageQueryUpdate on IsarQuery { - _ImageQueryUpdate get updateFirst => _ImageQueryUpdateImpl(this, limit: 1); - - _ImageQueryUpdate get updateAll => _ImageQueryUpdateImpl(this); -} - -class _ImageQueryBuilderUpdateImpl implements _ImageQueryUpdate { - const _ImageQueryBuilderUpdateImpl(this.query, {this.limit}); - - final QueryBuilder query; - final int? limit; - - @override - int call({ - Object? thumbnailPath = ignore, - Object? imagePath = ignore, - Object? lastSaved = ignore, - }) { - final q = query.build(); - try { - return q.updateProperties(limit: limit, { - if (thumbnailPath != ignore) 1: thumbnailPath as String?, - if (imagePath != ignore) 2: imagePath as String?, - if (lastSaved != ignore) 3: lastSaved as DateTime?, - }); - } finally { - q.close(); - } - } -} - -extension ImageQueryBuilderUpdate on QueryBuilder { - _ImageQueryUpdate get updateFirst => - _ImageQueryBuilderUpdateImpl(this, limit: 1); - - _ImageQueryUpdate get updateAll => _ImageQueryBuilderUpdateImpl(this); -} - -extension ImageQueryFilter on QueryBuilder { - QueryBuilder idEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder idGreaterThan( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder idGreaterThanOrEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder idLessThan( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder idLessThanOrEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder idBetween( - int lower, - int upper, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 0, - lower: lower, - upper: upper, - ), - ); - }); - } - - QueryBuilder thumbnailPathIsNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const IsNullCondition(property: 1)); - }); - } - - QueryBuilder thumbnailPathIsNotNull() { - return QueryBuilder.apply(not(), (query) { - return query.addFilterCondition(const IsNullCondition(property: 1)); - }); - } - - QueryBuilder thumbnailPathEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathGreaterThan( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder - thumbnailPathGreaterThanOrEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathLessThan( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder - thumbnailPathLessThanOrEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathBetween( - String? lower, - String? upper, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 1, - lower: lower, - upper: upper, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathStartsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - StartsWithCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathEndsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EndsWithCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathContains( - String value, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - ContainsCondition( - property: 1, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathMatches( - String pattern, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - MatchesCondition( - property: 1, - wildcard: pattern, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder thumbnailPathIsEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const EqualCondition( - property: 1, - value: '', - ), - ); - }); - } - - QueryBuilder thumbnailPathIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterCondition( - property: 1, - value: '', - ), - ); - }); - } - - QueryBuilder imagePathIsNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const IsNullCondition(property: 2)); - }); - } - - QueryBuilder imagePathIsNotNull() { - return QueryBuilder.apply(not(), (query) { - return query.addFilterCondition(const IsNullCondition(property: 2)); - }); - } - - QueryBuilder imagePathEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathGreaterThan( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder - imagePathGreaterThanOrEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathLessThan( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathLessThanOrEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathBetween( - String? lower, - String? upper, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 2, - lower: lower, - upper: upper, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathStartsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - StartsWithCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathEndsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EndsWithCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathContains( - String value, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - ContainsCondition( - property: 2, - value: value, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathMatches( - String pattern, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - MatchesCondition( - property: 2, - wildcard: pattern, - caseSensitive: caseSensitive, - ), - ); - }); - } - - QueryBuilder imagePathIsEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const EqualCondition( - property: 2, - value: '', - ), - ); - }); - } - - QueryBuilder imagePathIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - const GreaterCondition( - property: 2, - value: '', - ), - ); - }); - } - - QueryBuilder lastSavedEqualTo( - DateTime value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 3, - value: value, - ), - ); - }); - } - - QueryBuilder lastSavedGreaterThan( - DateTime value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 3, - value: value, - ), - ); - }); - } - - QueryBuilder - lastSavedGreaterThanOrEqualTo( - DateTime value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 3, - value: value, - ), - ); - }); - } - - QueryBuilder lastSavedLessThan( - DateTime value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 3, - value: value, - ), - ); - }); - } - - QueryBuilder lastSavedLessThanOrEqualTo( - DateTime value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 3, - value: value, - ), - ); - }); - } - - QueryBuilder lastSavedBetween( - DateTime lower, - DateTime upper, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 3, - lower: lower, - upper: upper, - ), - ); - }); - } -} - -extension ImageQueryObject on QueryBuilder {} - -extension ImageQuerySortBy on QueryBuilder { - QueryBuilder sortById() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0); - }); - } - - QueryBuilder sortByIdDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0, sort: Sort.desc); - }); - } - - QueryBuilder sortByThumbnailPath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy( - 1, - caseSensitive: caseSensitive, - ); - }); - } - - QueryBuilder sortByThumbnailPathDesc( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy( - 1, - sort: Sort.desc, - caseSensitive: caseSensitive, - ); - }); - } - - QueryBuilder sortByImagePath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy( - 2, - caseSensitive: caseSensitive, - ); - }); - } - - QueryBuilder sortByImagePathDesc( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy( - 2, - sort: Sort.desc, - caseSensitive: caseSensitive, - ); - }); - } - - QueryBuilder sortByLastSaved() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(3); - }); - } - - QueryBuilder sortByLastSavedDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(3, sort: Sort.desc); - }); - } -} - -extension ImageQuerySortThenBy on QueryBuilder { - QueryBuilder thenById() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0); - }); - } - - QueryBuilder thenByIdDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0, sort: Sort.desc); - }); - } - - QueryBuilder thenByThumbnailPath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1, caseSensitive: caseSensitive); - }); - } - - QueryBuilder thenByThumbnailPathDesc( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1, sort: Sort.desc, caseSensitive: caseSensitive); - }); - } - - QueryBuilder thenByImagePath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(2, caseSensitive: caseSensitive); - }); - } - - QueryBuilder thenByImagePathDesc( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(2, sort: Sort.desc, caseSensitive: caseSensitive); - }); - } - - QueryBuilder thenByLastSaved() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(3); - }); - } - - QueryBuilder thenByLastSavedDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(3, sort: Sort.desc); - }); - } -} - -extension ImageQueryWhereDistinct on QueryBuilder { - QueryBuilder distinctByThumbnailPath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(1, caseSensitive: caseSensitive); - }); - } - - QueryBuilder distinctByImagePath( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(2, caseSensitive: caseSensitive); - }); - } - - QueryBuilder distinctByLastSaved() { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(3); - }); - } -} - -extension ImageQueryProperty1 on QueryBuilder { - QueryBuilder idProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder thumbnailPathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } - - QueryBuilder imagePathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(2); - }); - } - - QueryBuilder lastSavedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(3); - }); - } -} - -extension ImageQueryProperty2 on QueryBuilder { - QueryBuilder idProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder thumbnailPathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } - - QueryBuilder imagePathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(2); - }); - } - - QueryBuilder lastSavedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(3); - }); - } -} - -extension ImageQueryProperty3 - on QueryBuilder { - QueryBuilder idProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder thumbnailPathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } - - QueryBuilder imagePathProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(2); - }); - } - - QueryBuilder lastSavedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(3); - }); - } -} diff --git a/lib/db/init.dart b/lib/db/init.dart index 8b5e7d0..452648e 100644 --- a/lib/db/init.dart +++ b/lib/db/init.dart @@ -1,6 +1,6 @@ import 'dart:io'; -import 'package:hive/hive.dart'; +import 'package:hive_plus_secure/hive_plus_secure.dart'; import 'package:path/path.dart' as p; import 'package:path_provider/path_provider.dart'; import 'package:vaani/main.dart'; diff --git a/lib/db/player_prefs/book_prefs.g.dart b/lib/db/player_prefs/book_prefs.g.dart deleted file mode 100644 index ee012a5..0000000 --- a/lib/db/player_prefs/book_prefs.g.dart +++ /dev/null @@ -1,496 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'book_prefs.dart'; - -// ************************************************************************** -// _IsarCollectionGenerator -// ************************************************************************** - -// coverage:ignore-file -// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors -// ignore_for_file: type=lint - -extension GetBookPrefsCollection on Isar { - IsarCollection get bookPrefs => this.collection(); -} - -const BookPrefsSchema = IsarGeneratedSchema( - schema: IsarSchema( - name: 'BookPrefs', - idName: 'libItemId', - embedded: false, - properties: [ - IsarPropertySchema( - name: 'speed', - type: IsarType.double, - ), - ], - indexes: [], - ), - converter: IsarObjectConverter( - serialize: serializeBookPrefs, - deserialize: deserializeBookPrefs, - deserializeProperty: deserializeBookPrefsProp, - ), - embeddedSchemas: [], -); - -@isarProtected -int serializeBookPrefs(IsarWriter writer, BookPrefs object) { - IsarCore.writeDouble(writer, 1, object.speed ?? double.nan); - return object.libItemId; -} - -@isarProtected -BookPrefs deserializeBookPrefs(IsarReader reader) { - final int _libItemId; - _libItemId = IsarCore.readId(reader); - final double? _speed; - { - final value = IsarCore.readDouble(reader, 1); - if (value.isNaN) { - _speed = null; - } else { - _speed = value; - } - } - final object = BookPrefs( - libItemId: _libItemId, - speed: _speed, - ); - return object; -} - -@isarProtected -dynamic deserializeBookPrefsProp(IsarReader reader, int property) { - switch (property) { - case 0: - return IsarCore.readId(reader); - case 1: - { - final value = IsarCore.readDouble(reader, 1); - if (value.isNaN) { - return null; - } else { - return value; - } - } - default: - throw ArgumentError('Unknown property: $property'); - } -} - -sealed class _BookPrefsUpdate { - bool call({ - required int libItemId, - double? speed, - }); -} - -class _BookPrefsUpdateImpl implements _BookPrefsUpdate { - const _BookPrefsUpdateImpl(this.collection); - - final IsarCollection collection; - - @override - bool call({ - required int libItemId, - Object? speed = ignore, - }) { - return collection.updateProperties([ - libItemId - ], { - if (speed != ignore) 1: speed as double?, - }) > - 0; - } -} - -sealed class _BookPrefsUpdateAll { - int call({ - required List libItemId, - double? speed, - }); -} - -class _BookPrefsUpdateAllImpl implements _BookPrefsUpdateAll { - const _BookPrefsUpdateAllImpl(this.collection); - - final IsarCollection collection; - - @override - int call({ - required List libItemId, - Object? speed = ignore, - }) { - return collection.updateProperties(libItemId, { - if (speed != ignore) 1: speed as double?, - }); - } -} - -extension BookPrefsUpdate on IsarCollection { - _BookPrefsUpdate get update => _BookPrefsUpdateImpl(this); - - _BookPrefsUpdateAll get updateAll => _BookPrefsUpdateAllImpl(this); -} - -sealed class _BookPrefsQueryUpdate { - int call({ - double? speed, - }); -} - -class _BookPrefsQueryUpdateImpl implements _BookPrefsQueryUpdate { - const _BookPrefsQueryUpdateImpl(this.query, {this.limit}); - - final IsarQuery query; - final int? limit; - - @override - int call({ - Object? speed = ignore, - }) { - return query.updateProperties(limit: limit, { - if (speed != ignore) 1: speed as double?, - }); - } -} - -extension BookPrefsQueryUpdate on IsarQuery { - _BookPrefsQueryUpdate get updateFirst => - _BookPrefsQueryUpdateImpl(this, limit: 1); - - _BookPrefsQueryUpdate get updateAll => _BookPrefsQueryUpdateImpl(this); -} - -class _BookPrefsQueryBuilderUpdateImpl implements _BookPrefsQueryUpdate { - const _BookPrefsQueryBuilderUpdateImpl(this.query, {this.limit}); - - final QueryBuilder query; - final int? limit; - - @override - int call({ - Object? speed = ignore, - }) { - final q = query.build(); - try { - return q.updateProperties(limit: limit, { - if (speed != ignore) 1: speed as double?, - }); - } finally { - q.close(); - } - } -} - -extension BookPrefsQueryBuilderUpdate - on QueryBuilder { - _BookPrefsQueryUpdate get updateFirst => - _BookPrefsQueryBuilderUpdateImpl(this, limit: 1); - - _BookPrefsQueryUpdate get updateAll => _BookPrefsQueryBuilderUpdateImpl(this); -} - -extension BookPrefsQueryFilter - on QueryBuilder { - QueryBuilder libItemIdEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder - libItemIdGreaterThan( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder - libItemIdGreaterThanOrEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder libItemIdLessThan( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder - libItemIdLessThanOrEqualTo( - int value, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 0, - value: value, - ), - ); - }); - } - - QueryBuilder libItemIdBetween( - int lower, - int upper, - ) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 0, - lower: lower, - upper: upper, - ), - ); - }); - } - - QueryBuilder speedIsNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const IsNullCondition(property: 1)); - }); - } - - QueryBuilder speedIsNotNull() { - return QueryBuilder.apply(not(), (query) { - return query.addFilterCondition(const IsNullCondition(property: 1)); - }); - } - - QueryBuilder speedEqualTo( - double? value, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - EqualCondition( - property: 1, - value: value, - epsilon: epsilon, - ), - ); - }); - } - - QueryBuilder speedGreaterThan( - double? value, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterCondition( - property: 1, - value: value, - epsilon: epsilon, - ), - ); - }); - } - - QueryBuilder - speedGreaterThanOrEqualTo( - double? value, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - GreaterOrEqualCondition( - property: 1, - value: value, - epsilon: epsilon, - ), - ); - }); - } - - QueryBuilder speedLessThan( - double? value, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessCondition( - property: 1, - value: value, - epsilon: epsilon, - ), - ); - }); - } - - QueryBuilder - speedLessThanOrEqualTo( - double? value, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - LessOrEqualCondition( - property: 1, - value: value, - epsilon: epsilon, - ), - ); - }); - } - - QueryBuilder speedBetween( - double? lower, - double? upper, { - double epsilon = Filter.epsilon, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition( - BetweenCondition( - property: 1, - lower: lower, - upper: upper, - epsilon: epsilon, - ), - ); - }); - } -} - -extension BookPrefsQueryObject - on QueryBuilder {} - -extension BookPrefsQuerySortBy on QueryBuilder { - QueryBuilder sortByLibItemId() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0); - }); - } - - QueryBuilder sortByLibItemIdDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0, sort: Sort.desc); - }); - } - - QueryBuilder sortBySpeed() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1); - }); - } - - QueryBuilder sortBySpeedDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1, sort: Sort.desc); - }); - } -} - -extension BookPrefsQuerySortThenBy - on QueryBuilder { - QueryBuilder thenByLibItemId() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0); - }); - } - - QueryBuilder thenByLibItemIdDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(0, sort: Sort.desc); - }); - } - - QueryBuilder thenBySpeed() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1); - }); - } - - QueryBuilder thenBySpeedDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(1, sort: Sort.desc); - }); - } -} - -extension BookPrefsQueryWhereDistinct - on QueryBuilder { - QueryBuilder distinctBySpeed() { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(1); - }); - } -} - -extension BookPrefsQueryProperty1 - on QueryBuilder { - QueryBuilder libItemIdProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder speedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } -} - -extension BookPrefsQueryProperty2 - on QueryBuilder { - QueryBuilder libItemIdProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder speedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } -} - -extension BookPrefsQueryProperty3 - on QueryBuilder { - QueryBuilder libItemIdProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(0); - }); - } - - QueryBuilder speedProperty() { - return QueryBuilder.apply(this, (query) { - return query.addProperty(1); - }); - } -} diff --git a/lib/db/register_models.dart b/lib/db/register_models.dart index e185e33..8695ab1 100644 --- a/lib/db/register_models.dart +++ b/lib/db/register_models.dart @@ -1,4 +1,4 @@ -import 'package:hive/hive.dart'; +import 'package:hive_plus_secure/hive_plus_secure.dart'; import 'package:vaani/features/per_book_settings/models/book_settings.dart'; import 'package:vaani/settings/models/models.dart'; diff --git a/lib/features/downloads/providers/download_manager.dart b/lib/features/downloads/providers/download_manager.dart index 6ffdded..7f75a17 100644 --- a/lib/features/downloads/providers/download_manager.dart +++ b/lib/features/downloads/providers/download_manager.dart @@ -110,7 +110,7 @@ class ItemDownloadProgress extends _$ItemDownloadProgress { final totalDownloadedSize = downloadedSize + inProgressFileSize; final progress = totalDownloadedSize / totalSize; // if current progress is more than calculated progress, do not update - if (progress < (state.valueOrNull ?? 0.0)) { + if (progress < (state.value ?? 0.0)) { return; } diff --git a/lib/features/downloads/providers/download_manager.g.dart b/lib/features/downloads/providers/download_manager.g.dart index 6b08886..0d0879e 100644 --- a/lib/features/downloads/providers/download_manager.g.dart +++ b/lib/features/downloads/providers/download_manager.g.dart @@ -6,627 +6,480 @@ part of 'download_manager.dart'; // RiverpodGenerator // ************************************************************************** -String _$downloadHistoryHash() => r'4d8b84e30f7ff5ae69d23c8e03ff24af1234a1ad'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); +@ProviderFor(SimpleDownloadManager) +final simpleDownloadManagerProvider = SimpleDownloadManagerProvider._(); - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [downloadHistory]. -@ProviderFor(downloadHistory) -const downloadHistoryProvider = DownloadHistoryFamily(); - -/// See also [downloadHistory]. -class DownloadHistoryFamily extends Family>> { - /// See also [downloadHistory]. - const DownloadHistoryFamily(); - - /// See also [downloadHistory]. - DownloadHistoryProvider call({ - String? group, - }) { - return DownloadHistoryProvider( - group: group, - ); - } - - @override - DownloadHistoryProvider getProviderOverride( - covariant DownloadHistoryProvider provider, - ) { - return call( - group: provider.group, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'downloadHistoryProvider'; -} - -/// See also [downloadHistory]. -class DownloadHistoryProvider - extends AutoDisposeFutureProvider> { - /// See also [downloadHistory]. - DownloadHistoryProvider({ - String? group, - }) : this._internal( - (ref) => downloadHistory( - ref as DownloadHistoryRef, - group: group, - ), - from: downloadHistoryProvider, - name: r'downloadHistoryProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$downloadHistoryHash, - dependencies: DownloadHistoryFamily._dependencies, - allTransitiveDependencies: - DownloadHistoryFamily._allTransitiveDependencies, - group: group, - ); - - DownloadHistoryProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.group, - }) : super.internal(); - - final String? group; - - @override - Override overrideWith( - FutureOr> Function(DownloadHistoryRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DownloadHistoryProvider._internal( - (ref) => create(ref as DownloadHistoryRef), - from: from, - name: null, +final class SimpleDownloadManagerProvider + extends + $NotifierProvider< + SimpleDownloadManager, + core.AudiobookDownloadManager + > { + SimpleDownloadManagerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'simpleDownloadManagerProvider', + isAutoDispose: false, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - group: group, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$simpleDownloadManagerHash(); + + @$internal + @override + SimpleDownloadManager create() => SimpleDownloadManager(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.AudiobookDownloadManager value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider( + value, ), ); } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _DownloadHistoryProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is DownloadHistoryProvider && other.group == group; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, group.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DownloadHistoryRef on AutoDisposeFutureProviderRef> { - /// The parameter `group` of this provider. - String? get group; -} - -class _DownloadHistoryProviderElement - extends AutoDisposeFutureProviderElement> - with DownloadHistoryRef { - _DownloadHistoryProviderElement(super.provider); - - @override - String? get group => (origin as DownloadHistoryProvider).group; } String _$simpleDownloadManagerHash() => r'8ab13f06ec5f2f73b73064bd285813dc890b7f36'; -/// See also [SimpleDownloadManager]. -@ProviderFor(SimpleDownloadManager) -final simpleDownloadManagerProvider = NotifierProvider.internal( - SimpleDownloadManager.new, - name: r'simpleDownloadManagerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$simpleDownloadManagerHash, - dependencies: null, - allTransitiveDependencies: null, -); +abstract class _$SimpleDownloadManager + extends $Notifier { + core.AudiobookDownloadManager build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref< + core.AudiobookDownloadManager, + core.AudiobookDownloadManager + >; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + core.AudiobookDownloadManager, + core.AudiobookDownloadManager + >, + core.AudiobookDownloadManager, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} -typedef _$SimpleDownloadManager = Notifier; -String _$downloadManagerHash() => r'852012e32e613f86445afc7f7e4e85bec808e982'; - -/// See also [DownloadManager]. @ProviderFor(DownloadManager) -final downloadManagerProvider = - NotifierProvider.internal( - DownloadManager.new, - name: r'downloadManagerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$downloadManagerHash, - dependencies: null, - allTransitiveDependencies: null, -); +final downloadManagerProvider = DownloadManagerProvider._(); -typedef _$DownloadManager = Notifier; -String _$isItemDownloadingHash() => r'ea43c06393beec828134e08d5f896ddbcfbac8f0'; - -abstract class _$IsItemDownloading extends BuildlessAutoDisposeNotifier { - late final String id; - - bool build( - String id, - ); -} - -/// See also [IsItemDownloading]. -@ProviderFor(IsItemDownloading) -const isItemDownloadingProvider = IsItemDownloadingFamily(); - -/// See also [IsItemDownloading]. -class IsItemDownloadingFamily extends Family { - /// See also [IsItemDownloading]. - const IsItemDownloadingFamily(); - - /// See also [IsItemDownloading]. - IsItemDownloadingProvider call( - String id, - ) { - return IsItemDownloadingProvider( - id, - ); - } - - @override - IsItemDownloadingProvider getProviderOverride( - covariant IsItemDownloadingProvider provider, - ) { - return call( - provider.id, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'isItemDownloadingProvider'; -} - -/// See also [IsItemDownloading]. -class IsItemDownloadingProvider - extends AutoDisposeNotifierProviderImpl { - /// See also [IsItemDownloading]. - IsItemDownloadingProvider( - String id, - ) : this._internal( - () => IsItemDownloading()..id = id, - from: isItemDownloadingProvider, - name: r'isItemDownloadingProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$isItemDownloadingHash, - dependencies: IsItemDownloadingFamily._dependencies, - allTransitiveDependencies: - IsItemDownloadingFamily._allTransitiveDependencies, - id: id, - ); - - IsItemDownloadingProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - bool runNotifierBuild( - covariant IsItemDownloading notifier, - ) { - return notifier.build( - id, - ); - } - - @override - Override overrideWith(IsItemDownloading Function() create) { - return ProviderOverride( - origin: this, - override: IsItemDownloadingProvider._internal( - () => create()..id = id, - from: from, - name: null, +final class DownloadManagerProvider + extends $NotifierProvider { + DownloadManagerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'downloadManagerProvider', + isAutoDispose: false, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$downloadManagerHash(); + + @$internal + @override + DownloadManager create() => DownloadManager(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.AudiobookDownloadManager value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider( + value, ), ); } +} + +String _$downloadManagerHash() => r'852012e32e613f86445afc7f7e4e85bec808e982'; + +abstract class _$DownloadManager + extends $Notifier { + core.AudiobookDownloadManager build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref< + core.AudiobookDownloadManager, + core.AudiobookDownloadManager + >; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + core.AudiobookDownloadManager, + core.AudiobookDownloadManager + >, + core.AudiobookDownloadManager, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} + +@ProviderFor(IsItemDownloading) +final isItemDownloadingProvider = IsItemDownloadingFamily._(); + +final class IsItemDownloadingProvider + extends $NotifierProvider { + IsItemDownloadingProvider._({ + required IsItemDownloadingFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'isItemDownloadingProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - AutoDisposeNotifierProviderElement createElement() { - return _IsItemDownloadingProviderElement(this); + String debugGetCreateSourceHash() => _$isItemDownloadingHash(); + + @override + String toString() { + return r'isItemDownloadingProvider' + '' + '($argument)'; + } + + @$internal + @override + IsItemDownloading create() => IsItemDownloading(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(bool value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); } @override bool operator ==(Object other) { - return other is IsItemDownloadingProvider && other.id == id; + return other is IsItemDownloadingProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin IsItemDownloadingRef on AutoDisposeNotifierProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$isItemDownloadingHash() => r'ea43c06393beec828134e08d5f896ddbcfbac8f0'; -class _IsItemDownloadingProviderElement - extends AutoDisposeNotifierProviderElement - with IsItemDownloadingRef { - _IsItemDownloadingProviderElement(super.provider); +final class IsItemDownloadingFamily extends $Family + with $ClassFamilyOverride { + IsItemDownloadingFamily._() + : super( + retry: null, + name: r'isItemDownloadingProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + IsItemDownloadingProvider call(String id) => + IsItemDownloadingProvider._(argument: id, from: this); @override - String get id => (origin as IsItemDownloadingProvider).id; + String toString() => r'isItemDownloadingProvider'; +} + +abstract class _$IsItemDownloading extends $Notifier { + late final _$args = ref.$arg as String; + String get id => _$args; + + bool build(String id); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + bool, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } +} + +@ProviderFor(ItemDownloadProgress) +final itemDownloadProgressProvider = ItemDownloadProgressFamily._(); + +final class ItemDownloadProgressProvider + extends $AsyncNotifierProvider { + ItemDownloadProgressProvider._({ + required ItemDownloadProgressFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'itemDownloadProgressProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$itemDownloadProgressHash(); + + @override + String toString() { + return r'itemDownloadProgressProvider' + '' + '($argument)'; + } + + @$internal + @override + ItemDownloadProgress create() => ItemDownloadProgress(); + + @override + bool operator ==(Object other) { + return other is ItemDownloadProgressProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$itemDownloadProgressHash() => - r'd007c55c6e2e4b992069d0306df8a600225d8598'; + r'95f6ec0945f73d9156bf89bdb1865f3b2c9ffcaa'; -abstract class _$ItemDownloadProgress - extends BuildlessAutoDisposeAsyncNotifier { - late final String id; - - FutureOr build( - String id, - ); -} - -/// See also [ItemDownloadProgress]. -@ProviderFor(ItemDownloadProgress) -const itemDownloadProgressProvider = ItemDownloadProgressFamily(); - -/// See also [ItemDownloadProgress]. -class ItemDownloadProgressFamily extends Family> { - /// See also [ItemDownloadProgress]. - const ItemDownloadProgressFamily(); - - /// See also [ItemDownloadProgress]. - ItemDownloadProgressProvider call( - String id, - ) { - return ItemDownloadProgressProvider( - id, - ); - } - - @override - ItemDownloadProgressProvider getProviderOverride( - covariant ItemDownloadProgressProvider provider, - ) { - return call( - provider.id, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'itemDownloadProgressProvider'; -} - -/// See also [ItemDownloadProgress]. -class ItemDownloadProgressProvider extends AutoDisposeAsyncNotifierProviderImpl< - ItemDownloadProgress, double?> { - /// See also [ItemDownloadProgress]. - ItemDownloadProgressProvider( - String id, - ) : this._internal( - () => ItemDownloadProgress()..id = id, - from: itemDownloadProgressProvider, - name: r'itemDownloadProgressProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$itemDownloadProgressHash, - dependencies: ItemDownloadProgressFamily._dependencies, - allTransitiveDependencies: - ItemDownloadProgressFamily._allTransitiveDependencies, - id: id, - ); - - ItemDownloadProgressProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - FutureOr runNotifierBuild( - covariant ItemDownloadProgress notifier, - ) { - return notifier.build( - id, - ); - } - - @override - Override overrideWith(ItemDownloadProgress Function() create) { - return ProviderOverride( - origin: this, - override: ItemDownloadProgressProvider._internal( - () => create()..id = id, - from: from, - name: null, +final class ItemDownloadProgressFamily extends $Family + with + $ClassFamilyOverride< + ItemDownloadProgress, + AsyncValue, + double?, + FutureOr, + String + > { + ItemDownloadProgressFamily._() + : super( + retry: null, + name: r'itemDownloadProgressProvider', dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + ItemDownloadProgressProvider call(String id) => + ItemDownloadProgressProvider._(argument: id, from: this); @override - AutoDisposeAsyncNotifierProviderElement - createElement() { - return _ItemDownloadProgressProviderElement(this); + String toString() => r'itemDownloadProgressProvider'; +} + +abstract class _$ItemDownloadProgress extends $AsyncNotifier { + late final _$args = ref.$arg as String; + String get id => _$args; + + FutureOr build(String id); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref, double?>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, double?>, + AsyncValue, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } +} + +@ProviderFor(downloadHistory) +final downloadHistoryProvider = DownloadHistoryFamily._(); + +final class DownloadHistoryProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + DownloadHistoryProvider._({ + required DownloadHistoryFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'downloadHistoryProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$downloadHistoryHash(); + + @override + String toString() { + return r'downloadHistoryProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as String?; + return downloadHistory(ref, group: argument); } @override bool operator ==(Object other) { - return other is ItemDownloadProgressProvider && other.id == id; + return other is DownloadHistoryProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ItemDownloadProgressRef on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$downloadHistoryHash() => r'4d8b84e30f7ff5ae69d23c8e03ff24af1234a1ad'; -class _ItemDownloadProgressProviderElement - extends AutoDisposeAsyncNotifierProviderElement with ItemDownloadProgressRef { - _ItemDownloadProgressProviderElement(super.provider); +final class DownloadHistoryFamily extends $Family + with $FunctionalFamilyOverride>, String?> { + DownloadHistoryFamily._() + : super( + retry: null, + name: r'downloadHistoryProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + DownloadHistoryProvider call({String? group}) => + DownloadHistoryProvider._(argument: group, from: this); @override - String get id => (origin as ItemDownloadProgressProvider).id; + String toString() => r'downloadHistoryProvider'; +} + +@ProviderFor(IsItemDownloaded) +final isItemDownloadedProvider = IsItemDownloadedFamily._(); + +final class IsItemDownloadedProvider + extends $AsyncNotifierProvider { + IsItemDownloadedProvider._({ + required IsItemDownloadedFamily super.from, + required LibraryItemExpanded super.argument, + }) : super( + retry: null, + name: r'isItemDownloadedProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$isItemDownloadedHash(); + + @override + String toString() { + return r'isItemDownloadedProvider' + '' + '($argument)'; + } + + @$internal + @override + IsItemDownloaded create() => IsItemDownloaded(); + + @override + bool operator ==(Object other) { + return other is IsItemDownloadedProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$isItemDownloadedHash() => r'9bb7ba28bdb73e1ba706e849fedc9c7bd67f4b67'; -abstract class _$IsItemDownloaded - extends BuildlessAutoDisposeAsyncNotifier { - late final LibraryItemExpanded item; - - FutureOr build( - LibraryItemExpanded item, - ); -} - -/// See also [IsItemDownloaded]. -@ProviderFor(IsItemDownloaded) -const isItemDownloadedProvider = IsItemDownloadedFamily(); - -/// See also [IsItemDownloaded]. -class IsItemDownloadedFamily extends Family> { - /// See also [IsItemDownloaded]. - const IsItemDownloadedFamily(); - - /// See also [IsItemDownloaded]. - IsItemDownloadedProvider call( - LibraryItemExpanded item, - ) { - return IsItemDownloadedProvider( - item, - ); - } - - @override - IsItemDownloadedProvider getProviderOverride( - covariant IsItemDownloadedProvider provider, - ) { - return call( - provider.item, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'isItemDownloadedProvider'; -} - -/// See also [IsItemDownloaded]. -class IsItemDownloadedProvider - extends AutoDisposeAsyncNotifierProviderImpl { - /// See also [IsItemDownloaded]. - IsItemDownloadedProvider( - LibraryItemExpanded item, - ) : this._internal( - () => IsItemDownloaded()..item = item, - from: isItemDownloadedProvider, - name: r'isItemDownloadedProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$isItemDownloadedHash, - dependencies: IsItemDownloadedFamily._dependencies, - allTransitiveDependencies: - IsItemDownloadedFamily._allTransitiveDependencies, - item: item, - ); - - IsItemDownloadedProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.item, - }) : super.internal(); - - final LibraryItemExpanded item; - - @override - FutureOr runNotifierBuild( - covariant IsItemDownloaded notifier, - ) { - return notifier.build( - item, - ); - } - - @override - Override overrideWith(IsItemDownloaded Function() create) { - return ProviderOverride( - origin: this, - override: IsItemDownloadedProvider._internal( - () => create()..item = item, - from: from, - name: null, +final class IsItemDownloadedFamily extends $Family + with + $ClassFamilyOverride< + IsItemDownloaded, + AsyncValue, + bool, + FutureOr, + LibraryItemExpanded + > { + IsItemDownloadedFamily._() + : super( + retry: null, + name: r'isItemDownloadedProvider', dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - item: item, - ), - ); - } + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + IsItemDownloadedProvider call(LibraryItemExpanded item) => + IsItemDownloadedProvider._(argument: item, from: this); @override - AutoDisposeAsyncNotifierProviderElement - createElement() { - return _IsItemDownloadedProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is IsItemDownloadedProvider && other.item == item; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, item.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'isItemDownloadedProvider'; } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin IsItemDownloadedRef on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `item` of this provider. - LibraryItemExpanded get item; -} - -class _IsItemDownloadedProviderElement - extends AutoDisposeAsyncNotifierProviderElement - with IsItemDownloadedRef { - _IsItemDownloadedProviderElement(super.provider); +abstract class _$IsItemDownloaded extends $AsyncNotifier { + late final _$args = ref.$arg as LibraryItemExpanded; + LibraryItemExpanded get item => _$args; + FutureOr build(LibraryItemExpanded item); + @$mustCallSuper @override - LibraryItemExpanded get item => (origin as IsItemDownloadedProvider).item; + void runBuild() { + final ref = this.ref as $Ref, bool>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, bool>, + AsyncValue, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/features/explore/providers/search_controller.g.dart b/lib/features/explore/providers/search_controller.g.dart index fab5671..a44d078 100644 --- a/lib/features/explore/providers/search_controller.g.dart +++ b/lib/features/explore/providers/search_controller.g.dart @@ -6,24 +6,64 @@ part of 'search_controller.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning +/// The controller for the search bar. + +@ProviderFor(GlobalSearchController) +final globalSearchControllerProvider = GlobalSearchControllerProvider._(); + +/// The controller for the search bar. +final class GlobalSearchControllerProvider + extends $NotifierProvider> { + /// The controller for the search bar. + GlobalSearchControllerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'globalSearchControllerProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$globalSearchControllerHash(); + + @$internal + @override + GlobalSearchController create() => GlobalSearchController(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Raw value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>(value), + ); + } +} + String _$globalSearchControllerHash() => r'd854ace6f2e00a10fc33aba63051375f82ad1b10'; /// The controller for the search bar. -/// -/// Copied from [GlobalSearchController]. -@ProviderFor(GlobalSearchController) -final globalSearchControllerProvider = - NotifierProvider>.internal( - GlobalSearchController.new, - name: r'globalSearchControllerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$globalSearchControllerHash, - dependencies: null, - allTransitiveDependencies: null, -); -typedef _$GlobalSearchController = Notifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$GlobalSearchController + extends $Notifier> { + Raw build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref, Raw>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, Raw>, + Raw, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/explore/providers/search_result_provider.g.dart b/lib/features/explore/providers/search_result_provider.g.dart index 764b781..51b077b 100644 --- a/lib/features/explore/providers/search_result_provider.g.dart +++ b/lib/features/explore/providers/search_result_provider.g.dart @@ -6,186 +6,94 @@ part of 'search_result_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$searchResultHash() => r'33785de298ad0d53c9d21e8fec88ba2f22f1363f'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// The provider for the search result. -/// -/// Copied from [searchResult]. + @ProviderFor(searchResult) -const searchResultProvider = SearchResultFamily(); +final searchResultProvider = SearchResultFamily._(); /// The provider for the search result. -/// -/// Copied from [searchResult]. -class SearchResultFamily extends Family> { - /// The provider for the search result. - /// - /// Copied from [searchResult]. - const SearchResultFamily(); +final class SearchResultProvider + extends + $FunctionalProvider< + AsyncValue, + LibrarySearchResponse?, + FutureOr + > + with + $FutureModifier, + $FutureProvider { /// The provider for the search result. - /// - /// Copied from [searchResult]. - SearchResultProvider call( - String query, { - int limit = 25, - }) { - return SearchResultProvider( - query, - limit: limit, - ); + SearchResultProvider._({ + required SearchResultFamily super.from, + required (String, {int limit}) super.argument, + }) : super( + retry: null, + name: r'searchResultProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$searchResultHash(); + + @override + String toString() { + return r'searchResultProvider' + '' + '$argument'; } + @$internal @override - SearchResultProvider getProviderOverride( - covariant SearchResultProvider provider, - ) { - return call( - provider.query, - limit: provider.limit, - ); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'searchResultProvider'; -} - -/// The provider for the search result. -/// -/// Copied from [searchResult]. -class SearchResultProvider - extends AutoDisposeFutureProvider { - /// The provider for the search result. - /// - /// Copied from [searchResult]. - SearchResultProvider( - String query, { - int limit = 25, - }) : this._internal( - (ref) => searchResult( - ref as SearchResultRef, - query, - limit: limit, - ), - from: searchResultProvider, - name: r'searchResultProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$searchResultHash, - dependencies: SearchResultFamily._dependencies, - allTransitiveDependencies: - SearchResultFamily._allTransitiveDependencies, - query: query, - limit: limit, - ); - - SearchResultProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.query, - required this.limit, - }) : super.internal(); - - final String query; - final int limit; - - @override - Override overrideWith( - FutureOr Function(SearchResultRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SearchResultProvider._internal( - (ref) => create(ref as SearchResultRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - query: query, - limit: limit, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _SearchResultProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, {int limit}); + return searchResult(ref, argument.$1, limit: argument.limit); } @override bool operator ==(Object other) { - return other is SearchResultProvider && - other.query == query && - other.limit == limit; + return other is SearchResultProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, query.hashCode); - hash = _SystemHash.combine(hash, limit.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SearchResultRef on AutoDisposeFutureProviderRef { - /// The parameter `query` of this provider. - String get query; +String _$searchResultHash() => r'33785de298ad0d53c9d21e8fec88ba2f22f1363f'; - /// The parameter `limit` of this provider. - int get limit; -} +/// The provider for the search result. -class _SearchResultProviderElement - extends AutoDisposeFutureProviderElement - with SearchResultRef { - _SearchResultProviderElement(super.provider); +final class SearchResultFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (String, {int limit}) + > { + SearchResultFamily._() + : super( + retry: null, + name: r'searchResultProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + /// The provider for the search result. + + SearchResultProvider call(String query, {int limit = 25}) => + SearchResultProvider._(argument: (query, limit: limit), from: this); @override - String get query => (origin as SearchResultProvider).query; - @override - int get limit => (origin as SearchResultProvider).limit; + String toString() => r'searchResultProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/features/explore/view/explore_page.dart b/lib/features/explore/view/explore_page.dart index 1682254..2ed7b52 100644 --- a/lib/features/explore/view/explore_page.dart +++ b/lib/features/explore/view/explore_page.dart @@ -232,7 +232,7 @@ class BookSearchResultMini extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final item = ref.watch(libraryItemProvider(book.libraryItemId)).valueOrNull; + final item = ref.watch(libraryItemProvider(book.libraryItemId)).value; final image = item == null ? const AsyncValue.loading() : ref.watch(coverImageProvider(item.id)); diff --git a/lib/features/item_viewer/view/library_item_actions.dart b/lib/features/item_viewer/view/library_item_actions.dart index fe5525f..7299e5c 100644 --- a/lib/features/item_viewer/view/library_item_actions.dart +++ b/lib/features/item_viewer/view/library_item_actions.dart @@ -35,7 +35,7 @@ class LibraryItemActions extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final item = ref.watch(libraryItemProvider(id)).valueOrNull; + final item = ref.watch(libraryItemProvider(id)).value; if (item == null) { return const SizedBox.shrink(); } @@ -216,7 +216,7 @@ class LibItemDownloadButton extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final isItemDownloaded = ref.watch(isItemDownloadedProvider(item)); - if (isItemDownloaded.valueOrNull ?? false) { + if (isItemDownloaded.value ?? false) { return AlreadyItemDownloadedButton(item: item); } final isItemDownloading = ref.watch(isItemDownloadingProvider(item.id)); @@ -252,7 +252,7 @@ class ItemCurrentlyInDownloadQueue extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final progress = ref .watch(itemDownloadProgressProvider(item.id)) - .valueOrNull + .value ?.clamp(0.05, 1.0); if (progress == 1) { diff --git a/lib/features/item_viewer/view/library_item_hero_section.dart b/lib/features/item_viewer/view/library_item_hero_section.dart index da4adea..ae83420 100644 --- a/lib/features/item_viewer/view/library_item_hero_section.dart +++ b/lib/features/item_viewer/view/library_item_hero_section.dart @@ -90,7 +90,7 @@ class _BookDetails extends HookConsumerWidget { final itemFromApi = ref.watch(libraryItemProvider(id)); final itemBookMetadata = - itemFromApi.valueOrNull?.media.metadata.asBookMetadataExpanded; + itemFromApi.value?.media.metadata.asBookMetadataExpanded; return Expanded( child: Padding( @@ -143,7 +143,7 @@ class _LibraryItemProgressIndicator extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final player = ref.watch(audiobookPlayerProvider); - final libraryItem = ref.watch(libraryItemProvider(id)).valueOrNull; + final libraryItem = ref.watch(libraryItemProvider(id)).value; if (libraryItem == null) { return const SizedBox.shrink(); } @@ -362,7 +362,7 @@ class _BookCover extends HookConsumerWidget { MediaQuery.of(context).highContrast, ), ) - .valueOrNull; + .value; } return ThemeSwitcher( diff --git a/lib/features/item_viewer/view/library_item_metadata.dart b/lib/features/item_viewer/view/library_item_metadata.dart index 664daac..753a38e 100644 --- a/lib/features/item_viewer/view/library_item_metadata.dart +++ b/lib/features/item_viewer/view/library_item_metadata.dart @@ -13,7 +13,7 @@ class LibraryItemMetadata extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final item = ref.watch(libraryItemProvider(id)).valueOrNull; + final item = ref.watch(libraryItemProvider(id)).value; /// formats the duration of the book as `10h 30m` /// diff --git a/lib/features/item_viewer/view/library_item_page.dart b/lib/features/item_viewer/view/library_item_page.dart index e7b9310..b685a6a 100644 --- a/lib/features/item_viewer/view/library_item_page.dart +++ b/lib/features/item_viewer/view/library_item_page.dart @@ -145,7 +145,7 @@ class LibraryItemDescription extends HookConsumerWidget { final String id; @override Widget build(BuildContext context, WidgetRef ref) { - final item = ref.watch(libraryItemProvider(id)).valueOrNull; + final item = ref.watch(libraryItemProvider(id)).value; if (item == null) { return const SizedBox(); } diff --git a/lib/features/item_viewer/view/library_item_sliver_app_bar.dart b/lib/features/item_viewer/view/library_item_sliver_app_bar.dart index fd6b621..5616a96 100644 --- a/lib/features/item_viewer/view/library_item_sliver_app_bar.dart +++ b/lib/features/item_viewer/view/library_item_sliver_app_bar.dart @@ -17,7 +17,7 @@ class LibraryItemSliverAppBar extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final item = ref.watch(libraryItemProvider(id)).valueOrNull; + final item = ref.watch(libraryItemProvider(id)).value; final showTitle = useState(false); diff --git a/lib/features/library_browser/view/library_browser_page.dart b/lib/features/library_browser/view/library_browser_page.dart index 4327b17..26cb2df 100644 --- a/lib/features/library_browser/view/library_browser_page.dart +++ b/lib/features/library_browser/view/library_browser_page.dart @@ -13,7 +13,7 @@ class LibraryBrowserPage extends HookConsumerWidget { const LibraryBrowserPage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final currentLibrary = ref.watch(currentLibraryProvider).valueOrNull; + final currentLibrary = ref.watch(currentLibraryProvider).value; // Determine the icon to use, with a fallback final IconData libraryIconData = diff --git a/lib/features/logging/providers/logs_provider.g.dart b/lib/features/logging/providers/logs_provider.g.dart index 53babc0..c7bb6f8 100644 --- a/lib/features/logging/providers/logs_provider.g.dart +++ b/lib/features/logging/providers/logs_provider.g.dart @@ -6,20 +6,48 @@ part of 'logs_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(Logs) +final logsProvider = LogsProvider._(); + +final class LogsProvider extends $AsyncNotifierProvider> { + LogsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'logsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$logsHash(); + + @$internal + @override + Logs create() => Logs(); +} + String _$logsHash() => r'aa9d3d56586cba6ddf69615320ea605d071ea5e2'; -/// See also [Logs]. -@ProviderFor(Logs) -final logsProvider = - AutoDisposeAsyncNotifierProvider>.internal( - Logs.new, - name: r'logsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$logsHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$Logs = AutoDisposeAsyncNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$Logs extends $AsyncNotifier> { + FutureOr> build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier>, List>, + AsyncValue>, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/onboarding/models/flow.dart b/lib/features/onboarding/models/flow.dart index 80e8514..46539f6 100644 --- a/lib/features/onboarding/models/flow.dart +++ b/lib/features/onboarding/models/flow.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'flow.freezed.dart'; @freezed -class Flow with _$Flow { +sealed class Flow with _$Flow { const factory Flow({ required Uri serverUri, required String state, diff --git a/lib/features/onboarding/models/flow.freezed.dart b/lib/features/onboarding/models/flow.freezed.dart index 1437f2e..f79c8bb 100644 --- a/lib/features/onboarding/models/flow.freezed.dart +++ b/lib/features/onboarding/models/flow.freezed.dart @@ -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,241 +9,272 @@ part of 'flow.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(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 _$Flow { - Uri get serverUri => throw _privateConstructorUsedError; - String get state => throw _privateConstructorUsedError; - String get verifier => throw _privateConstructorUsedError; - Cookie get cookie => throw _privateConstructorUsedError; - bool get isFlowComplete => throw _privateConstructorUsedError; - String? get authToken => throw _privateConstructorUsedError; - /// Create a copy of Flow - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $FlowCopyWith get copyWith => throw _privateConstructorUsedError; + Uri get serverUri; String get state; String get verifier; Cookie get cookie; bool get isFlowComplete; String? get authToken; +/// Create a copy of Flow +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$FlowCopyWith get copyWith => _$FlowCopyWithImpl(this as Flow, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Flow&&(identical(other.serverUri, serverUri) || other.serverUri == serverUri)&&(identical(other.state, state) || other.state == state)&&(identical(other.verifier, verifier) || other.verifier == verifier)&&(identical(other.cookie, cookie) || other.cookie == cookie)&&(identical(other.isFlowComplete, isFlowComplete) || other.isFlowComplete == isFlowComplete)&&(identical(other.authToken, authToken) || other.authToken == authToken)); +} + + +@override +int get hashCode => Object.hash(runtimeType,serverUri,state,verifier,cookie,isFlowComplete,authToken); + +@override +String toString() { + return 'Flow(serverUri: $serverUri, state: $state, verifier: $verifier, cookie: $cookie, isFlowComplete: $isFlowComplete, authToken: $authToken)'; +} + + } /// @nodoc -abstract class $FlowCopyWith<$Res> { - factory $FlowCopyWith(Flow value, $Res Function(Flow) then) = - _$FlowCopyWithImpl<$Res, Flow>; - @useResult - $Res call( - {Uri serverUri, - String state, - String verifier, - Cookie cookie, - bool isFlowComplete, - String? authToken}); -} +abstract mixin class $FlowCopyWith<$Res> { + factory $FlowCopyWith(Flow value, $Res Function(Flow) _then) = _$FlowCopyWithImpl; +@useResult +$Res call({ + Uri serverUri, String state, String verifier, Cookie cookie, bool isFlowComplete, String? authToken +}); + + + +} /// @nodoc -class _$FlowCopyWithImpl<$Res, $Val extends Flow> +class _$FlowCopyWithImpl<$Res> implements $FlowCopyWith<$Res> { - _$FlowCopyWithImpl(this._value, this._then); + _$FlowCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final Flow _self; + final $Res Function(Flow) _then; - /// Create a copy of Flow - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? serverUri = null, - Object? state = null, - Object? verifier = null, - Object? cookie = null, - Object? isFlowComplete = null, - Object? authToken = freezed, - }) { - return _then(_value.copyWith( - serverUri: null == serverUri - ? _value.serverUri - : serverUri // ignore: cast_nullable_to_non_nullable - as Uri, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - verifier: null == verifier - ? _value.verifier - : verifier // ignore: cast_nullable_to_non_nullable - as String, - cookie: null == cookie - ? _value.cookie - : cookie // ignore: cast_nullable_to_non_nullable - as Cookie, - isFlowComplete: null == isFlowComplete - ? _value.isFlowComplete - : isFlowComplete // ignore: cast_nullable_to_non_nullable - as bool, - authToken: freezed == authToken - ? _value.authToken - : authToken // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } +/// Create a copy of Flow +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? serverUri = null,Object? state = null,Object? verifier = null,Object? cookie = null,Object? isFlowComplete = null,Object? authToken = freezed,}) { + return _then(_self.copyWith( +serverUri: null == serverUri ? _self.serverUri : serverUri // ignore: cast_nullable_to_non_nullable +as Uri,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,verifier: null == verifier ? _self.verifier : verifier // ignore: cast_nullable_to_non_nullable +as String,cookie: null == cookie ? _self.cookie : cookie // ignore: cast_nullable_to_non_nullable +as Cookie,isFlowComplete: null == isFlowComplete ? _self.isFlowComplete : isFlowComplete // ignore: cast_nullable_to_non_nullable +as bool,authToken: freezed == authToken ? _self.authToken : authToken // ignore: cast_nullable_to_non_nullable +as String?, + )); } -/// @nodoc -abstract class _$$FlowImplCopyWith<$Res> implements $FlowCopyWith<$Res> { - factory _$$FlowImplCopyWith( - _$FlowImpl value, $Res Function(_$FlowImpl) then) = - __$$FlowImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {Uri serverUri, - String state, - String verifier, - Cookie cookie, - bool isFlowComplete, - String? authToken}); } -/// @nodoc -class __$$FlowImplCopyWithImpl<$Res> - extends _$FlowCopyWithImpl<$Res, _$FlowImpl> - implements _$$FlowImplCopyWith<$Res> { - __$$FlowImplCopyWithImpl(_$FlowImpl _value, $Res Function(_$FlowImpl) _then) - : super(_value, _then); - /// Create a copy of Flow - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? serverUri = null, - Object? state = null, - Object? verifier = null, - Object? cookie = null, - Object? isFlowComplete = null, - Object? authToken = freezed, - }) { - return _then(_$FlowImpl( - serverUri: null == serverUri - ? _value.serverUri - : serverUri // ignore: cast_nullable_to_non_nullable - as Uri, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - verifier: null == verifier - ? _value.verifier - : verifier // ignore: cast_nullable_to_non_nullable - as String, - cookie: null == cookie - ? _value.cookie - : cookie // ignore: cast_nullable_to_non_nullable - as Cookie, - isFlowComplete: null == isFlowComplete - ? _value.isFlowComplete - : isFlowComplete // ignore: cast_nullable_to_non_nullable - as bool, - authToken: freezed == authToken - ? _value.authToken - : authToken // ignore: cast_nullable_to_non_nullable - as String?, - )); - } +/// Adds pattern-matching-related methods to [Flow]. +extension FlowPatterns on Flow { +/// 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 Function( _Flow value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Flow() 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 Function( _Flow value) $default,){ +final _that = this; +switch (_that) { +case _Flow(): +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? Function( _Flow value)? $default,){ +final _that = this; +switch (_that) { +case _Flow() 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 Function( Uri serverUri, String state, String verifier, Cookie cookie, bool isFlowComplete, String? authToken)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Flow() when $default != null: +return $default(_that.serverUri,_that.state,_that.verifier,_that.cookie,_that.isFlowComplete,_that.authToken);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 Function( Uri serverUri, String state, String verifier, Cookie cookie, bool isFlowComplete, String? authToken) $default,) {final _that = this; +switch (_that) { +case _Flow(): +return $default(_that.serverUri,_that.state,_that.verifier,_that.cookie,_that.isFlowComplete,_that.authToken);} +} +/// 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? Function( Uri serverUri, String state, String verifier, Cookie cookie, bool isFlowComplete, String? authToken)? $default,) {final _that = this; +switch (_that) { +case _Flow() when $default != null: +return $default(_that.serverUri,_that.state,_that.verifier,_that.cookie,_that.isFlowComplete,_that.authToken);case _: + return null; + +} +} + } /// @nodoc -class _$FlowImpl implements _Flow { - const _$FlowImpl( - {required this.serverUri, - required this.state, - required this.verifier, - required this.cookie, - this.isFlowComplete = false, - this.authToken}); - @override - final Uri serverUri; - @override - final String state; - @override - final String verifier; - @override - final Cookie cookie; - @override - @JsonKey() - final bool isFlowComplete; - @override - final String? authToken; +class _Flow implements Flow { + const _Flow({required this.serverUri, required this.state, required this.verifier, required this.cookie, this.isFlowComplete = false, this.authToken}); + - @override - String toString() { - return 'Flow(serverUri: $serverUri, state: $state, verifier: $verifier, cookie: $cookie, isFlowComplete: $isFlowComplete, authToken: $authToken)'; - } +@override final Uri serverUri; +@override final String state; +@override final String verifier; +@override final Cookie cookie; +@override@JsonKey() final bool isFlowComplete; +@override final String? authToken; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$FlowImpl && - (identical(other.serverUri, serverUri) || - other.serverUri == serverUri) && - (identical(other.state, state) || other.state == state) && - (identical(other.verifier, verifier) || - other.verifier == verifier) && - (identical(other.cookie, cookie) || other.cookie == cookie) && - (identical(other.isFlowComplete, isFlowComplete) || - other.isFlowComplete == isFlowComplete) && - (identical(other.authToken, authToken) || - other.authToken == authToken)); - } +/// Create a copy of Flow +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$FlowCopyWith<_Flow> get copyWith => __$FlowCopyWithImpl<_Flow>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, serverUri, state, verifier, - cookie, isFlowComplete, authToken); - /// Create a copy of Flow - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$FlowImplCopyWith<_$FlowImpl> get copyWith => - __$$FlowImplCopyWithImpl<_$FlowImpl>(this, _$identity); + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Flow&&(identical(other.serverUri, serverUri) || other.serverUri == serverUri)&&(identical(other.state, state) || other.state == state)&&(identical(other.verifier, verifier) || other.verifier == verifier)&&(identical(other.cookie, cookie) || other.cookie == cookie)&&(identical(other.isFlowComplete, isFlowComplete) || other.isFlowComplete == isFlowComplete)&&(identical(other.authToken, authToken) || other.authToken == authToken)); } -abstract class _Flow implements Flow { - const factory _Flow( - {required final Uri serverUri, - required final String state, - required final String verifier, - required final Cookie cookie, - final bool isFlowComplete, - final String? authToken}) = _$FlowImpl; - @override - Uri get serverUri; - @override - String get state; - @override - String get verifier; - @override - Cookie get cookie; - @override - bool get isFlowComplete; - @override - String? get authToken; +@override +int get hashCode => Object.hash(runtimeType,serverUri,state,verifier,cookie,isFlowComplete,authToken); - /// Create a copy of Flow - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$FlowImplCopyWith<_$FlowImpl> get copyWith => - throw _privateConstructorUsedError; +@override +String toString() { + return 'Flow(serverUri: $serverUri, state: $state, verifier: $verifier, cookie: $cookie, isFlowComplete: $isFlowComplete, authToken: $authToken)'; } + + +} + +/// @nodoc +abstract mixin class _$FlowCopyWith<$Res> implements $FlowCopyWith<$Res> { + factory _$FlowCopyWith(_Flow value, $Res Function(_Flow) _then) = __$FlowCopyWithImpl; +@override @useResult +$Res call({ + Uri serverUri, String state, String verifier, Cookie cookie, bool isFlowComplete, String? authToken +}); + + + + +} +/// @nodoc +class __$FlowCopyWithImpl<$Res> + implements _$FlowCopyWith<$Res> { + __$FlowCopyWithImpl(this._self, this._then); + + final _Flow _self; + final $Res Function(_Flow) _then; + +/// Create a copy of Flow +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? serverUri = null,Object? state = null,Object? verifier = null,Object? cookie = null,Object? isFlowComplete = null,Object? authToken = freezed,}) { + return _then(_Flow( +serverUri: null == serverUri ? _self.serverUri : serverUri // ignore: cast_nullable_to_non_nullable +as Uri,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,verifier: null == verifier ? _self.verifier : verifier // ignore: cast_nullable_to_non_nullable +as String,cookie: null == cookie ? _self.cookie : cookie // ignore: cast_nullable_to_non_nullable +as Cookie,isFlowComplete: null == isFlowComplete ? _self.isFlowComplete : isFlowComplete // ignore: cast_nullable_to_non_nullable +as bool,authToken: freezed == authToken ? _self.authToken : authToken // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/lib/features/onboarding/providers/oauth_provider.g.dart b/lib/features/onboarding/providers/oauth_provider.g.dart index 8f44538..d9c7575 100644 --- a/lib/features/onboarding/providers/oauth_provider.g.dart +++ b/lib/features/onboarding/providers/oauth_provider.g.dart @@ -6,221 +6,167 @@ part of 'oauth_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$loginInExchangeForCodeHash() => - r'bfc3945529048a0f536052fd5579b76457560fcd'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); +@ProviderFor(OauthFlows) +final oauthFlowsProvider = OauthFlowsProvider._(); - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// the code returned by the server in exchange for the verifier -/// -/// Copied from [loginInExchangeForCode]. -@ProviderFor(loginInExchangeForCode) -const loginInExchangeForCodeProvider = LoginInExchangeForCodeFamily(); - -/// the code returned by the server in exchange for the verifier -/// -/// Copied from [loginInExchangeForCode]. -class LoginInExchangeForCodeFamily extends Family> { - /// the code returned by the server in exchange for the verifier - /// - /// Copied from [loginInExchangeForCode]. - const LoginInExchangeForCodeFamily(); - - /// the code returned by the server in exchange for the verifier - /// - /// Copied from [loginInExchangeForCode]. - LoginInExchangeForCodeProvider call({ - required String oauthState, - required String code, - ErrorResponseHandler? responseHandler, - }) { - return LoginInExchangeForCodeProvider( - oauthState: oauthState, - code: code, - responseHandler: responseHandler, - ); - } - - @override - LoginInExchangeForCodeProvider getProviderOverride( - covariant LoginInExchangeForCodeProvider provider, - ) { - return call( - oauthState: provider.oauthState, - code: provider.code, - responseHandler: provider.responseHandler, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'loginInExchangeForCodeProvider'; -} - -/// the code returned by the server in exchange for the verifier -/// -/// Copied from [loginInExchangeForCode]. -class LoginInExchangeForCodeProvider - extends AutoDisposeFutureProvider { - /// the code returned by the server in exchange for the verifier - /// - /// Copied from [loginInExchangeForCode]. - LoginInExchangeForCodeProvider({ - required String oauthState, - required String code, - ErrorResponseHandler? responseHandler, - }) : this._internal( - (ref) => loginInExchangeForCode( - ref as LoginInExchangeForCodeRef, - oauthState: oauthState, - code: code, - responseHandler: responseHandler, - ), - from: loginInExchangeForCodeProvider, - name: r'loginInExchangeForCodeProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$loginInExchangeForCodeHash, - dependencies: LoginInExchangeForCodeFamily._dependencies, - allTransitiveDependencies: - LoginInExchangeForCodeFamily._allTransitiveDependencies, - oauthState: oauthState, - code: code, - responseHandler: responseHandler, - ); - - LoginInExchangeForCodeProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.oauthState, - required this.code, - required this.responseHandler, - }) : super.internal(); - - final String oauthState; - final String code; - final ErrorResponseHandler? responseHandler; - - @override - Override overrideWith( - FutureOr Function(LoginInExchangeForCodeRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: LoginInExchangeForCodeProvider._internal( - (ref) => create(ref as LoginInExchangeForCodeRef), - from: from, - name: null, +final class OauthFlowsProvider + extends $NotifierProvider> { + OauthFlowsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'oauthFlowsProvider', + isAutoDispose: false, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - oauthState: oauthState, - code: code, - responseHandler: responseHandler, - ), - ); - } + $allTransitiveDependencies: null, + ); @override - AutoDisposeFutureProviderElement createElement() { - return _LoginInExchangeForCodeProviderElement(this); + String debugGetCreateSourceHash() => _$oauthFlowsHash(); + + @$internal + @override + OauthFlows create() => OauthFlows(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Map value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>(value), + ); + } +} + +String _$oauthFlowsHash() => r'4e278baa0bf26f2a10694ca2caadb68dd5b6156f'; + +abstract class _$OauthFlows extends $Notifier> { + Map build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref, Map>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, Map>, + Map, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} + +/// the code returned by the server in exchange for the verifier + +@ProviderFor(loginInExchangeForCode) +final loginInExchangeForCodeProvider = LoginInExchangeForCodeFamily._(); + +/// the code returned by the server in exchange for the verifier + +final class LoginInExchangeForCodeProvider + extends $FunctionalProvider, String?, FutureOr> + with $FutureModifier, $FutureProvider { + /// the code returned by the server in exchange for the verifier + LoginInExchangeForCodeProvider._({ + required LoginInExchangeForCodeFamily super.from, + required ({ + State oauthState, + Code code, + ErrorResponseHandler? responseHandler, + }) + super.argument, + }) : super( + retry: null, + name: r'loginInExchangeForCodeProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$loginInExchangeForCodeHash(); + + @override + String toString() { + return r'loginInExchangeForCodeProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = + this.argument + as ({ + State oauthState, + Code code, + ErrorResponseHandler? responseHandler, + }); + return loginInExchangeForCode( + ref, + oauthState: argument.oauthState, + code: argument.code, + responseHandler: argument.responseHandler, + ); } @override bool operator ==(Object other) { return other is LoginInExchangeForCodeProvider && - other.oauthState == oauthState && - other.code == code && - other.responseHandler == responseHandler; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, oauthState.hashCode); - hash = _SystemHash.combine(hash, code.hashCode); - hash = _SystemHash.combine(hash, responseHandler.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LoginInExchangeForCodeRef on AutoDisposeFutureProviderRef { - /// The parameter `oauthState` of this provider. - String get oauthState; +String _$loginInExchangeForCodeHash() => + r'bfc3945529048a0f536052fd5579b76457560fcd'; - /// The parameter `code` of this provider. - String get code; +/// the code returned by the server in exchange for the verifier - /// The parameter `responseHandler` of this provider. - ErrorResponseHandler? get responseHandler; +final class LoginInExchangeForCodeFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + ({State oauthState, Code code, ErrorResponseHandler? responseHandler}) + > { + LoginInExchangeForCodeFamily._() + : super( + retry: null, + name: r'loginInExchangeForCodeProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + /// the code returned by the server in exchange for the verifier + + LoginInExchangeForCodeProvider call({ + required State oauthState, + required Code code, + ErrorResponseHandler? responseHandler, + }) => LoginInExchangeForCodeProvider._( + argument: ( + oauthState: oauthState, + code: code, + responseHandler: responseHandler, + ), + from: this, + ); + + @override + String toString() => r'loginInExchangeForCodeProvider'; } - -class _LoginInExchangeForCodeProviderElement - extends AutoDisposeFutureProviderElement - with LoginInExchangeForCodeRef { - _LoginInExchangeForCodeProviderElement(super.provider); - - @override - String get oauthState => - (origin as LoginInExchangeForCodeProvider).oauthState; - @override - String get code => (origin as LoginInExchangeForCodeProvider).code; - @override - ErrorResponseHandler? get responseHandler => - (origin as LoginInExchangeForCodeProvider).responseHandler; -} - -String _$oauthFlowsHash() => r'4e278baa0bf26f2a10694ca2caadb68dd5b6156f'; - -/// See also [OauthFlows]. -@ProviderFor(OauthFlows) -final oauthFlowsProvider = - NotifierProvider>.internal( - OauthFlows.new, - name: r'oauthFlowsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$oauthFlowsHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$OauthFlows = Notifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/features/per_book_settings/models/book_settings.dart b/lib/features/per_book_settings/models/book_settings.dart index b4f0cda..853fe53 100644 --- a/lib/features/per_book_settings/models/book_settings.dart +++ b/lib/features/per_book_settings/models/book_settings.dart @@ -6,7 +6,7 @@ part 'book_settings.g.dart'; /// per book settings @freezed -class BookSettings with _$BookSettings { +sealed class BookSettings with _$BookSettings { const factory BookSettings({ required String bookId, @Default(NullablePlayerSettings()) NullablePlayerSettings playerSettings, diff --git a/lib/features/per_book_settings/models/book_settings.freezed.dart b/lib/features/per_book_settings/models/book_settings.freezed.dart index 63b55da..8ba7009 100644 --- a/lib/features/per_book_settings/models/book_settings.freezed.dart +++ b/lib/features/per_book_settings/models/book_settings.freezed.dart @@ -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,195 +9,284 @@ part of 'book_settings.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(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'); - -BookSettings _$BookSettingsFromJson(Map json) { - return _BookSettings.fromJson(json); -} - /// @nodoc mixin _$BookSettings { - String get bookId => throw _privateConstructorUsedError; - NullablePlayerSettings get playerSettings => - throw _privateConstructorUsedError; + + String get bookId; NullablePlayerSettings get playerSettings; +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$BookSettingsCopyWith get copyWith => _$BookSettingsCopyWithImpl(this as BookSettings, _$identity); /// Serializes this BookSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is BookSettings&&(identical(other.bookId, bookId) || other.bookId == bookId)&&(identical(other.playerSettings, playerSettings) || other.playerSettings == playerSettings)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,bookId,playerSettings); + +@override +String toString() { + return 'BookSettings(bookId: $bookId, playerSettings: $playerSettings)'; +} + - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $BookSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $BookSettingsCopyWith<$Res> { - factory $BookSettingsCopyWith( - BookSettings value, $Res Function(BookSettings) then) = - _$BookSettingsCopyWithImpl<$Res, BookSettings>; - @useResult - $Res call({String bookId, NullablePlayerSettings playerSettings}); +abstract mixin class $BookSettingsCopyWith<$Res> { + factory $BookSettingsCopyWith(BookSettings value, $Res Function(BookSettings) _then) = _$BookSettingsCopyWithImpl; +@useResult +$Res call({ + String bookId, NullablePlayerSettings playerSettings +}); + + +$NullablePlayerSettingsCopyWith<$Res> get playerSettings; - $NullablePlayerSettingsCopyWith<$Res> get playerSettings; } - /// @nodoc -class _$BookSettingsCopyWithImpl<$Res, $Val extends BookSettings> +class _$BookSettingsCopyWithImpl<$Res> implements $BookSettingsCopyWith<$Res> { - _$BookSettingsCopyWithImpl(this._value, this._then); + _$BookSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final BookSettings _self; + final $Res Function(BookSettings) _then; - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? bookId = null, - Object? playerSettings = null, - }) { - return _then(_value.copyWith( - bookId: null == bookId - ? _value.bookId - : bookId // ignore: cast_nullable_to_non_nullable - as String, - playerSettings: null == playerSettings - ? _value.playerSettings - : playerSettings // ignore: cast_nullable_to_non_nullable - as NullablePlayerSettings, - ) as $Val); - } - - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $NullablePlayerSettingsCopyWith<$Res> get playerSettings { - return $NullablePlayerSettingsCopyWith<$Res>(_value.playerSettings, - (value) { - return _then(_value.copyWith(playerSettings: value) as $Val); - }); - } +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? bookId = null,Object? playerSettings = null,}) { + return _then(_self.copyWith( +bookId: null == bookId ? _self.bookId : bookId // ignore: cast_nullable_to_non_nullable +as String,playerSettings: null == playerSettings ? _self.playerSettings : playerSettings // ignore: cast_nullable_to_non_nullable +as NullablePlayerSettings, + )); +} +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$NullablePlayerSettingsCopyWith<$Res> get playerSettings { + + return $NullablePlayerSettingsCopyWith<$Res>(_self.playerSettings, (value) { + return _then(_self.copyWith(playerSettings: value)); + }); +} } -/// @nodoc -abstract class _$$BookSettingsImplCopyWith<$Res> - implements $BookSettingsCopyWith<$Res> { - factory _$$BookSettingsImplCopyWith( - _$BookSettingsImpl value, $Res Function(_$BookSettingsImpl) then) = - __$$BookSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String bookId, NullablePlayerSettings playerSettings}); - @override - $NullablePlayerSettingsCopyWith<$Res> get playerSettings; +/// Adds pattern-matching-related methods to [BookSettings]. +extension BookSettingsPatterns on BookSettings { +/// 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 Function( _BookSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BookSettings() 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 Function( _BookSettings value) $default,){ +final _that = this; +switch (_that) { +case _BookSettings(): +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? Function( _BookSettings value)? $default,){ +final _that = this; +switch (_that) { +case _BookSettings() 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 Function( String bookId, NullablePlayerSettings playerSettings)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BookSettings() when $default != null: +return $default(_that.bookId,_that.playerSettings);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 Function( String bookId, NullablePlayerSettings playerSettings) $default,) {final _that = this; +switch (_that) { +case _BookSettings(): +return $default(_that.bookId,_that.playerSettings);} +} +/// 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? Function( String bookId, NullablePlayerSettings playerSettings)? $default,) {final _that = this; +switch (_that) { +case _BookSettings() when $default != null: +return $default(_that.bookId,_that.playerSettings);case _: + return null; + +} } -/// @nodoc -class __$$BookSettingsImplCopyWithImpl<$Res> - extends _$BookSettingsCopyWithImpl<$Res, _$BookSettingsImpl> - implements _$$BookSettingsImplCopyWith<$Res> { - __$$BookSettingsImplCopyWithImpl( - _$BookSettingsImpl _value, $Res Function(_$BookSettingsImpl) _then) - : super(_value, _then); - - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? bookId = null, - Object? playerSettings = null, - }) { - return _then(_$BookSettingsImpl( - bookId: null == bookId - ? _value.bookId - : bookId // ignore: cast_nullable_to_non_nullable - as String, - playerSettings: null == playerSettings - ? _value.playerSettings - : playerSettings // ignore: cast_nullable_to_non_nullable - as NullablePlayerSettings, - )); - } } /// @nodoc @JsonSerializable() -class _$BookSettingsImpl implements _BookSettings { - const _$BookSettingsImpl( - {required this.bookId, - this.playerSettings = const NullablePlayerSettings()}); - factory _$BookSettingsImpl.fromJson(Map json) => - _$$BookSettingsImplFromJson(json); +class _BookSettings implements BookSettings { + const _BookSettings({required this.bookId, this.playerSettings = const NullablePlayerSettings()}); + factory _BookSettings.fromJson(Map json) => _$BookSettingsFromJson(json); - @override - final String bookId; - @override - @JsonKey() - final NullablePlayerSettings playerSettings; +@override final String bookId; +@override@JsonKey() final NullablePlayerSettings playerSettings; - @override - String toString() { - return 'BookSettings(bookId: $bookId, playerSettings: $playerSettings)'; - } +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$BookSettingsCopyWith<_BookSettings> get copyWith => __$BookSettingsCopyWithImpl<_BookSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$BookSettingsImpl && - (identical(other.bookId, bookId) || other.bookId == bookId) && - (identical(other.playerSettings, playerSettings) || - other.playerSettings == playerSettings)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, bookId, playerSettings); - - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$BookSettingsImplCopyWith<_$BookSettingsImpl> get copyWith => - __$$BookSettingsImplCopyWithImpl<_$BookSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$BookSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$BookSettingsToJson(this, ); } -abstract class _BookSettings implements BookSettings { - const factory _BookSettings( - {required final String bookId, - final NullablePlayerSettings playerSettings}) = _$BookSettingsImpl; - - factory _BookSettings.fromJson(Map json) = - _$BookSettingsImpl.fromJson; - - @override - String get bookId; - @override - NullablePlayerSettings get playerSettings; - - /// Create a copy of BookSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$BookSettingsImplCopyWith<_$BookSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _BookSettings&&(identical(other.bookId, bookId) || other.bookId == bookId)&&(identical(other.playerSettings, playerSettings) || other.playerSettings == playerSettings)); } + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,bookId,playerSettings); + +@override +String toString() { + return 'BookSettings(bookId: $bookId, playerSettings: $playerSettings)'; +} + + +} + +/// @nodoc +abstract mixin class _$BookSettingsCopyWith<$Res> implements $BookSettingsCopyWith<$Res> { + factory _$BookSettingsCopyWith(_BookSettings value, $Res Function(_BookSettings) _then) = __$BookSettingsCopyWithImpl; +@override @useResult +$Res call({ + String bookId, NullablePlayerSettings playerSettings +}); + + +@override $NullablePlayerSettingsCopyWith<$Res> get playerSettings; + +} +/// @nodoc +class __$BookSettingsCopyWithImpl<$Res> + implements _$BookSettingsCopyWith<$Res> { + __$BookSettingsCopyWithImpl(this._self, this._then); + + final _BookSettings _self; + final $Res Function(_BookSettings) _then; + +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? bookId = null,Object? playerSettings = null,}) { + return _then(_BookSettings( +bookId: null == bookId ? _self.bookId : bookId // ignore: cast_nullable_to_non_nullable +as String,playerSettings: null == playerSettings ? _self.playerSettings : playerSettings // ignore: cast_nullable_to_non_nullable +as NullablePlayerSettings, + )); +} + +/// Create a copy of BookSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$NullablePlayerSettingsCopyWith<$Res> get playerSettings { + + return $NullablePlayerSettingsCopyWith<$Res>(_self.playerSettings, (value) { + return _then(_self.copyWith(playerSettings: value)); + }); +} +} + +// dart format on diff --git a/lib/features/per_book_settings/models/book_settings.g.dart b/lib/features/per_book_settings/models/book_settings.g.dart index a66fba1..b5888f7 100644 --- a/lib/features/per_book_settings/models/book_settings.g.dart +++ b/lib/features/per_book_settings/models/book_settings.g.dart @@ -6,16 +6,17 @@ part of 'book_settings.dart'; // JsonSerializableGenerator // ************************************************************************** -_$BookSettingsImpl _$$BookSettingsImplFromJson(Map json) => - _$BookSettingsImpl( +_BookSettings _$BookSettingsFromJson(Map json) => + _BookSettings( bookId: json['bookId'] as String, playerSettings: json['playerSettings'] == null ? const NullablePlayerSettings() : NullablePlayerSettings.fromJson( - json['playerSettings'] as Map), + json['playerSettings'] as Map, + ), ); -Map _$$BookSettingsImplToJson(_$BookSettingsImpl instance) => +Map _$BookSettingsToJson(_BookSettings instance) => { 'bookId': instance.bookId, 'playerSettings': instance.playerSettings, diff --git a/lib/features/per_book_settings/models/nullable_player_settings.dart b/lib/features/per_book_settings/models/nullable_player_settings.dart index 39135d7..d54e2eb 100644 --- a/lib/features/per_book_settings/models/nullable_player_settings.dart +++ b/lib/features/per_book_settings/models/nullable_player_settings.dart @@ -5,7 +5,7 @@ part 'nullable_player_settings.freezed.dart'; part 'nullable_player_settings.g.dart'; @freezed -class NullablePlayerSettings with _$NullablePlayerSettings { +sealed class NullablePlayerSettings with _$NullablePlayerSettings { const factory NullablePlayerSettings({ MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, diff --git a/lib/features/per_book_settings/models/nullable_player_settings.freezed.dart b/lib/features/per_book_settings/models/nullable_player_settings.freezed.dart index 9450ed4..8039d60 100644 --- a/lib/features/per_book_settings/models/nullable_player_settings.freezed.dart +++ b/lib/features/per_book_settings/models/nullable_player_settings.freezed.dart @@ -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,369 +9,361 @@ part of 'nullable_player_settings.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(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'); - -NullablePlayerSettings _$NullablePlayerSettingsFromJson( - Map json) { - return _NullablePlayerSettings.fromJson(json); -} - /// @nodoc mixin _$NullablePlayerSettings { - MinimizedPlayerSettings? get miniPlayerSettings => - throw _privateConstructorUsedError; - ExpandedPlayerSettings? get expandedPlayerSettings => - throw _privateConstructorUsedError; - double? get preferredDefaultVolume => throw _privateConstructorUsedError; - double? get preferredDefaultSpeed => throw _privateConstructorUsedError; - List? get speedOptions => throw _privateConstructorUsedError; - SleepTimerSettings? get sleepTimerSettings => - throw _privateConstructorUsedError; - Duration? get playbackReportInterval => throw _privateConstructorUsedError; + + MinimizedPlayerSettings? get miniPlayerSettings; ExpandedPlayerSettings? get expandedPlayerSettings; double? get preferredDefaultVolume; double? get preferredDefaultSpeed; List? get speedOptions; SleepTimerSettings? get sleepTimerSettings; Duration? get playbackReportInterval; +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$NullablePlayerSettingsCopyWith get copyWith => _$NullablePlayerSettingsCopyWithImpl(this as NullablePlayerSettings, _$identity); /// Serializes this NullablePlayerSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is NullablePlayerSettings&&(identical(other.miniPlayerSettings, miniPlayerSettings) || other.miniPlayerSettings == miniPlayerSettings)&&(identical(other.expandedPlayerSettings, expandedPlayerSettings) || other.expandedPlayerSettings == expandedPlayerSettings)&&(identical(other.preferredDefaultVolume, preferredDefaultVolume) || other.preferredDefaultVolume == preferredDefaultVolume)&&(identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || other.preferredDefaultSpeed == preferredDefaultSpeed)&&const DeepCollectionEquality().equals(other.speedOptions, speedOptions)&&(identical(other.sleepTimerSettings, sleepTimerSettings) || other.sleepTimerSettings == sleepTimerSettings)&&(identical(other.playbackReportInterval, playbackReportInterval) || other.playbackReportInterval == playbackReportInterval)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,miniPlayerSettings,expandedPlayerSettings,preferredDefaultVolume,preferredDefaultSpeed,const DeepCollectionEquality().hash(speedOptions),sleepTimerSettings,playbackReportInterval); + +@override +String toString() { + return 'NullablePlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, sleepTimerSettings: $sleepTimerSettings, playbackReportInterval: $playbackReportInterval)'; +} + - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $NullablePlayerSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $NullablePlayerSettingsCopyWith<$Res> { - factory $NullablePlayerSettingsCopyWith(NullablePlayerSettings value, - $Res Function(NullablePlayerSettings) then) = - _$NullablePlayerSettingsCopyWithImpl<$Res, NullablePlayerSettings>; - @useResult - $Res call( - {MinimizedPlayerSettings? miniPlayerSettings, - ExpandedPlayerSettings? expandedPlayerSettings, - double? preferredDefaultVolume, - double? preferredDefaultSpeed, - List? speedOptions, - SleepTimerSettings? sleepTimerSettings, - Duration? playbackReportInterval}); +abstract mixin class $NullablePlayerSettingsCopyWith<$Res> { + factory $NullablePlayerSettingsCopyWith(NullablePlayerSettings value, $Res Function(NullablePlayerSettings) _then) = _$NullablePlayerSettingsCopyWithImpl; +@useResult +$Res call({ + MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, double? preferredDefaultVolume, double? preferredDefaultSpeed, List? speedOptions, SleepTimerSettings? sleepTimerSettings, Duration? playbackReportInterval +}); + + +$MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings;$ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings;$SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings; - $MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings; - $ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings; - $SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings; } - /// @nodoc -class _$NullablePlayerSettingsCopyWithImpl<$Res, - $Val extends NullablePlayerSettings> +class _$NullablePlayerSettingsCopyWithImpl<$Res> implements $NullablePlayerSettingsCopyWith<$Res> { - _$NullablePlayerSettingsCopyWithImpl(this._value, this._then); + _$NullablePlayerSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final NullablePlayerSettings _self; + final $Res Function(NullablePlayerSettings) _then; - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? miniPlayerSettings = freezed, - Object? expandedPlayerSettings = freezed, - Object? preferredDefaultVolume = freezed, - Object? preferredDefaultSpeed = freezed, - Object? speedOptions = freezed, - Object? sleepTimerSettings = freezed, - Object? playbackReportInterval = freezed, - }) { - return _then(_value.copyWith( - miniPlayerSettings: freezed == miniPlayerSettings - ? _value.miniPlayerSettings - : miniPlayerSettings // ignore: cast_nullable_to_non_nullable - as MinimizedPlayerSettings?, - expandedPlayerSettings: freezed == expandedPlayerSettings - ? _value.expandedPlayerSettings - : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable - as ExpandedPlayerSettings?, - preferredDefaultVolume: freezed == preferredDefaultVolume - ? _value.preferredDefaultVolume - : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable - as double?, - preferredDefaultSpeed: freezed == preferredDefaultSpeed - ? _value.preferredDefaultSpeed - : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable - as double?, - speedOptions: freezed == speedOptions - ? _value.speedOptions - : speedOptions // ignore: cast_nullable_to_non_nullable - as List?, - sleepTimerSettings: freezed == sleepTimerSettings - ? _value.sleepTimerSettings - : sleepTimerSettings // ignore: cast_nullable_to_non_nullable - as SleepTimerSettings?, - playbackReportInterval: freezed == playbackReportInterval - ? _value.playbackReportInterval - : playbackReportInterval // ignore: cast_nullable_to_non_nullable - as Duration?, - ) as $Val); +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? miniPlayerSettings = freezed,Object? expandedPlayerSettings = freezed,Object? preferredDefaultVolume = freezed,Object? preferredDefaultSpeed = freezed,Object? speedOptions = freezed,Object? sleepTimerSettings = freezed,Object? playbackReportInterval = freezed,}) { + return _then(_self.copyWith( +miniPlayerSettings: freezed == miniPlayerSettings ? _self.miniPlayerSettings : miniPlayerSettings // ignore: cast_nullable_to_non_nullable +as MinimizedPlayerSettings?,expandedPlayerSettings: freezed == expandedPlayerSettings ? _self.expandedPlayerSettings : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable +as ExpandedPlayerSettings?,preferredDefaultVolume: freezed == preferredDefaultVolume ? _self.preferredDefaultVolume : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable +as double?,preferredDefaultSpeed: freezed == preferredDefaultSpeed ? _self.preferredDefaultSpeed : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable +as double?,speedOptions: freezed == speedOptions ? _self.speedOptions : speedOptions // ignore: cast_nullable_to_non_nullable +as List?,sleepTimerSettings: freezed == sleepTimerSettings ? _self.sleepTimerSettings : sleepTimerSettings // ignore: cast_nullable_to_non_nullable +as SleepTimerSettings?,playbackReportInterval: freezed == playbackReportInterval ? _self.playbackReportInterval : playbackReportInterval // ignore: cast_nullable_to_non_nullable +as Duration?, + )); +} +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings { + if (_self.miniPlayerSettings == null) { + return null; } - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings { - if (_value.miniPlayerSettings == null) { - return null; - } - - return $MinimizedPlayerSettingsCopyWith<$Res>(_value.miniPlayerSettings!, - (value) { - return _then(_value.copyWith(miniPlayerSettings: value) as $Val); - }); + return $MinimizedPlayerSettingsCopyWith<$Res>(_self.miniPlayerSettings!, (value) { + return _then(_self.copyWith(miniPlayerSettings: value)); + }); +}/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings { + if (_self.expandedPlayerSettings == null) { + return null; } - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings { - if (_value.expandedPlayerSettings == null) { - return null; - } - - return $ExpandedPlayerSettingsCopyWith<$Res>(_value.expandedPlayerSettings!, - (value) { - return _then(_value.copyWith(expandedPlayerSettings: value) as $Val); - }); + return $ExpandedPlayerSettingsCopyWith<$Res>(_self.expandedPlayerSettings!, (value) { + return _then(_self.copyWith(expandedPlayerSettings: value)); + }); +}/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings { + if (_self.sleepTimerSettings == null) { + return null; } - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings { - if (_value.sleepTimerSettings == null) { - return null; - } - - return $SleepTimerSettingsCopyWith<$Res>(_value.sleepTimerSettings!, - (value) { - return _then(_value.copyWith(sleepTimerSettings: value) as $Val); - }); - } + return $SleepTimerSettingsCopyWith<$Res>(_self.sleepTimerSettings!, (value) { + return _then(_self.copyWith(sleepTimerSettings: value)); + }); +} } -/// @nodoc -abstract class _$$NullablePlayerSettingsImplCopyWith<$Res> - implements $NullablePlayerSettingsCopyWith<$Res> { - factory _$$NullablePlayerSettingsImplCopyWith( - _$NullablePlayerSettingsImpl value, - $Res Function(_$NullablePlayerSettingsImpl) then) = - __$$NullablePlayerSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {MinimizedPlayerSettings? miniPlayerSettings, - ExpandedPlayerSettings? expandedPlayerSettings, - double? preferredDefaultVolume, - double? preferredDefaultSpeed, - List? speedOptions, - SleepTimerSettings? sleepTimerSettings, - Duration? playbackReportInterval}); - @override - $MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings; - @override - $ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings; - @override - $SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings; +/// Adds pattern-matching-related methods to [NullablePlayerSettings]. +extension NullablePlayerSettingsPatterns on NullablePlayerSettings { +/// 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 Function( _NullablePlayerSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _NullablePlayerSettings() 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 Function( _NullablePlayerSettings value) $default,){ +final _that = this; +switch (_that) { +case _NullablePlayerSettings(): +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? Function( _NullablePlayerSettings value)? $default,){ +final _that = this; +switch (_that) { +case _NullablePlayerSettings() 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 Function( MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, double? preferredDefaultVolume, double? preferredDefaultSpeed, List? speedOptions, SleepTimerSettings? sleepTimerSettings, Duration? playbackReportInterval)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _NullablePlayerSettings() when $default != null: +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.sleepTimerSettings,_that.playbackReportInterval);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 Function( MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, double? preferredDefaultVolume, double? preferredDefaultSpeed, List? speedOptions, SleepTimerSettings? sleepTimerSettings, Duration? playbackReportInterval) $default,) {final _that = this; +switch (_that) { +case _NullablePlayerSettings(): +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.sleepTimerSettings,_that.playbackReportInterval);} +} +/// 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? Function( MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, double? preferredDefaultVolume, double? preferredDefaultSpeed, List? speedOptions, SleepTimerSettings? sleepTimerSettings, Duration? playbackReportInterval)? $default,) {final _that = this; +switch (_that) { +case _NullablePlayerSettings() when $default != null: +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.sleepTimerSettings,_that.playbackReportInterval);case _: + return null; + +} } -/// @nodoc -class __$$NullablePlayerSettingsImplCopyWithImpl<$Res> - extends _$NullablePlayerSettingsCopyWithImpl<$Res, - _$NullablePlayerSettingsImpl> - implements _$$NullablePlayerSettingsImplCopyWith<$Res> { - __$$NullablePlayerSettingsImplCopyWithImpl( - _$NullablePlayerSettingsImpl _value, - $Res Function(_$NullablePlayerSettingsImpl) _then) - : super(_value, _then); - - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? miniPlayerSettings = freezed, - Object? expandedPlayerSettings = freezed, - Object? preferredDefaultVolume = freezed, - Object? preferredDefaultSpeed = freezed, - Object? speedOptions = freezed, - Object? sleepTimerSettings = freezed, - Object? playbackReportInterval = freezed, - }) { - return _then(_$NullablePlayerSettingsImpl( - miniPlayerSettings: freezed == miniPlayerSettings - ? _value.miniPlayerSettings - : miniPlayerSettings // ignore: cast_nullable_to_non_nullable - as MinimizedPlayerSettings?, - expandedPlayerSettings: freezed == expandedPlayerSettings - ? _value.expandedPlayerSettings - : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable - as ExpandedPlayerSettings?, - preferredDefaultVolume: freezed == preferredDefaultVolume - ? _value.preferredDefaultVolume - : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable - as double?, - preferredDefaultSpeed: freezed == preferredDefaultSpeed - ? _value.preferredDefaultSpeed - : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable - as double?, - speedOptions: freezed == speedOptions - ? _value._speedOptions - : speedOptions // ignore: cast_nullable_to_non_nullable - as List?, - sleepTimerSettings: freezed == sleepTimerSettings - ? _value.sleepTimerSettings - : sleepTimerSettings // ignore: cast_nullable_to_non_nullable - as SleepTimerSettings?, - playbackReportInterval: freezed == playbackReportInterval - ? _value.playbackReportInterval - : playbackReportInterval // ignore: cast_nullable_to_non_nullable - as Duration?, - )); - } } /// @nodoc @JsonSerializable() -class _$NullablePlayerSettingsImpl implements _NullablePlayerSettings { - const _$NullablePlayerSettingsImpl( - {this.miniPlayerSettings, - this.expandedPlayerSettings, - this.preferredDefaultVolume, - this.preferredDefaultSpeed, - final List? speedOptions, - this.sleepTimerSettings, - this.playbackReportInterval}) - : _speedOptions = speedOptions; - factory _$NullablePlayerSettingsImpl.fromJson(Map json) => - _$$NullablePlayerSettingsImplFromJson(json); +class _NullablePlayerSettings implements NullablePlayerSettings { + const _NullablePlayerSettings({this.miniPlayerSettings, this.expandedPlayerSettings, this.preferredDefaultVolume, this.preferredDefaultSpeed, final List? speedOptions, this.sleepTimerSettings, this.playbackReportInterval}): _speedOptions = speedOptions; + factory _NullablePlayerSettings.fromJson(Map json) => _$NullablePlayerSettingsFromJson(json); - @override - final MinimizedPlayerSettings? miniPlayerSettings; - @override - final ExpandedPlayerSettings? expandedPlayerSettings; - @override - final double? preferredDefaultVolume; - @override - final double? preferredDefaultSpeed; - final List? _speedOptions; - @override - List? get speedOptions { - final value = _speedOptions; - if (value == null) return null; - if (_speedOptions is EqualUnmodifiableListView) return _speedOptions; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final SleepTimerSettings? sleepTimerSettings; - @override - final Duration? playbackReportInterval; - - @override - String toString() { - return 'NullablePlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, sleepTimerSettings: $sleepTimerSettings, playbackReportInterval: $playbackReportInterval)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NullablePlayerSettingsImpl && - (identical(other.miniPlayerSettings, miniPlayerSettings) || - other.miniPlayerSettings == miniPlayerSettings) && - (identical(other.expandedPlayerSettings, expandedPlayerSettings) || - other.expandedPlayerSettings == expandedPlayerSettings) && - (identical(other.preferredDefaultVolume, preferredDefaultVolume) || - other.preferredDefaultVolume == preferredDefaultVolume) && - (identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || - other.preferredDefaultSpeed == preferredDefaultSpeed) && - const DeepCollectionEquality() - .equals(other._speedOptions, _speedOptions) && - (identical(other.sleepTimerSettings, sleepTimerSettings) || - other.sleepTimerSettings == sleepTimerSettings) && - (identical(other.playbackReportInterval, playbackReportInterval) || - other.playbackReportInterval == playbackReportInterval)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - miniPlayerSettings, - expandedPlayerSettings, - preferredDefaultVolume, - preferredDefaultSpeed, - const DeepCollectionEquality().hash(_speedOptions), - sleepTimerSettings, - playbackReportInterval); - - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$NullablePlayerSettingsImplCopyWith<_$NullablePlayerSettingsImpl> - get copyWith => __$$NullablePlayerSettingsImplCopyWithImpl< - _$NullablePlayerSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$NullablePlayerSettingsImplToJson( - this, - ); - } +@override final MinimizedPlayerSettings? miniPlayerSettings; +@override final ExpandedPlayerSettings? expandedPlayerSettings; +@override final double? preferredDefaultVolume; +@override final double? preferredDefaultSpeed; + final List? _speedOptions; +@override List? get speedOptions { + final value = _speedOptions; + if (value == null) return null; + if (_speedOptions is EqualUnmodifiableListView) return _speedOptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); } -abstract class _NullablePlayerSettings implements NullablePlayerSettings { - const factory _NullablePlayerSettings( - {final MinimizedPlayerSettings? miniPlayerSettings, - final ExpandedPlayerSettings? expandedPlayerSettings, - final double? preferredDefaultVolume, - final double? preferredDefaultSpeed, - final List? speedOptions, - final SleepTimerSettings? sleepTimerSettings, - final Duration? playbackReportInterval}) = _$NullablePlayerSettingsImpl; +@override final SleepTimerSettings? sleepTimerSettings; +@override final Duration? playbackReportInterval; - factory _NullablePlayerSettings.fromJson(Map json) = - _$NullablePlayerSettingsImpl.fromJson; +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$NullablePlayerSettingsCopyWith<_NullablePlayerSettings> get copyWith => __$NullablePlayerSettingsCopyWithImpl<_NullablePlayerSettings>(this, _$identity); - @override - MinimizedPlayerSettings? get miniPlayerSettings; - @override - ExpandedPlayerSettings? get expandedPlayerSettings; - @override - double? get preferredDefaultVolume; - @override - double? get preferredDefaultSpeed; - @override - List? get speedOptions; - @override - SleepTimerSettings? get sleepTimerSettings; - @override - Duration? get playbackReportInterval; - - /// Create a copy of NullablePlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$NullablePlayerSettingsImplCopyWith<_$NullablePlayerSettingsImpl> - get copyWith => throw _privateConstructorUsedError; +@override +Map toJson() { + return _$NullablePlayerSettingsToJson(this, ); } + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _NullablePlayerSettings&&(identical(other.miniPlayerSettings, miniPlayerSettings) || other.miniPlayerSettings == miniPlayerSettings)&&(identical(other.expandedPlayerSettings, expandedPlayerSettings) || other.expandedPlayerSettings == expandedPlayerSettings)&&(identical(other.preferredDefaultVolume, preferredDefaultVolume) || other.preferredDefaultVolume == preferredDefaultVolume)&&(identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || other.preferredDefaultSpeed == preferredDefaultSpeed)&&const DeepCollectionEquality().equals(other._speedOptions, _speedOptions)&&(identical(other.sleepTimerSettings, sleepTimerSettings) || other.sleepTimerSettings == sleepTimerSettings)&&(identical(other.playbackReportInterval, playbackReportInterval) || other.playbackReportInterval == playbackReportInterval)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,miniPlayerSettings,expandedPlayerSettings,preferredDefaultVolume,preferredDefaultSpeed,const DeepCollectionEquality().hash(_speedOptions),sleepTimerSettings,playbackReportInterval); + +@override +String toString() { + return 'NullablePlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, sleepTimerSettings: $sleepTimerSettings, playbackReportInterval: $playbackReportInterval)'; +} + + +} + +/// @nodoc +abstract mixin class _$NullablePlayerSettingsCopyWith<$Res> implements $NullablePlayerSettingsCopyWith<$Res> { + factory _$NullablePlayerSettingsCopyWith(_NullablePlayerSettings value, $Res Function(_NullablePlayerSettings) _then) = __$NullablePlayerSettingsCopyWithImpl; +@override @useResult +$Res call({ + MinimizedPlayerSettings? miniPlayerSettings, ExpandedPlayerSettings? expandedPlayerSettings, double? preferredDefaultVolume, double? preferredDefaultSpeed, List? speedOptions, SleepTimerSettings? sleepTimerSettings, Duration? playbackReportInterval +}); + + +@override $MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings;@override $ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings;@override $SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings; + +} +/// @nodoc +class __$NullablePlayerSettingsCopyWithImpl<$Res> + implements _$NullablePlayerSettingsCopyWith<$Res> { + __$NullablePlayerSettingsCopyWithImpl(this._self, this._then); + + final _NullablePlayerSettings _self; + final $Res Function(_NullablePlayerSettings) _then; + +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? miniPlayerSettings = freezed,Object? expandedPlayerSettings = freezed,Object? preferredDefaultVolume = freezed,Object? preferredDefaultSpeed = freezed,Object? speedOptions = freezed,Object? sleepTimerSettings = freezed,Object? playbackReportInterval = freezed,}) { + return _then(_NullablePlayerSettings( +miniPlayerSettings: freezed == miniPlayerSettings ? _self.miniPlayerSettings : miniPlayerSettings // ignore: cast_nullable_to_non_nullable +as MinimizedPlayerSettings?,expandedPlayerSettings: freezed == expandedPlayerSettings ? _self.expandedPlayerSettings : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable +as ExpandedPlayerSettings?,preferredDefaultVolume: freezed == preferredDefaultVolume ? _self.preferredDefaultVolume : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable +as double?,preferredDefaultSpeed: freezed == preferredDefaultSpeed ? _self.preferredDefaultSpeed : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable +as double?,speedOptions: freezed == speedOptions ? _self._speedOptions : speedOptions // ignore: cast_nullable_to_non_nullable +as List?,sleepTimerSettings: freezed == sleepTimerSettings ? _self.sleepTimerSettings : sleepTimerSettings // ignore: cast_nullable_to_non_nullable +as SleepTimerSettings?,playbackReportInterval: freezed == playbackReportInterval ? _self.playbackReportInterval : playbackReportInterval // ignore: cast_nullable_to_non_nullable +as Duration?, + )); +} + +/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MinimizedPlayerSettingsCopyWith<$Res>? get miniPlayerSettings { + if (_self.miniPlayerSettings == null) { + return null; + } + + return $MinimizedPlayerSettingsCopyWith<$Res>(_self.miniPlayerSettings!, (value) { + return _then(_self.copyWith(miniPlayerSettings: value)); + }); +}/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ExpandedPlayerSettingsCopyWith<$Res>? get expandedPlayerSettings { + if (_self.expandedPlayerSettings == null) { + return null; + } + + return $ExpandedPlayerSettingsCopyWith<$Res>(_self.expandedPlayerSettings!, (value) { + return _then(_self.copyWith(expandedPlayerSettings: value)); + }); +}/// Create a copy of NullablePlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SleepTimerSettingsCopyWith<$Res>? get sleepTimerSettings { + if (_self.sleepTimerSettings == null) { + return null; + } + + return $SleepTimerSettingsCopyWith<$Res>(_self.sleepTimerSettings!, (value) { + return _then(_self.copyWith(sleepTimerSettings: value)); + }); +} +} + +// dart format on diff --git a/lib/features/per_book_settings/models/nullable_player_settings.g.dart b/lib/features/per_book_settings/models/nullable_player_settings.g.dart index 28eb3bc..3c45864 100644 --- a/lib/features/per_book_settings/models/nullable_player_settings.g.dart +++ b/lib/features/per_book_settings/models/nullable_player_settings.g.dart @@ -6,42 +6,42 @@ part of 'nullable_player_settings.dart'; // JsonSerializableGenerator // ************************************************************************** -_$NullablePlayerSettingsImpl _$$NullablePlayerSettingsImplFromJson( - Map json) => - _$NullablePlayerSettingsImpl( - miniPlayerSettings: json['miniPlayerSettings'] == null - ? null - : MinimizedPlayerSettings.fromJson( - json['miniPlayerSettings'] as Map), - expandedPlayerSettings: json['expandedPlayerSettings'] == null - ? null - : ExpandedPlayerSettings.fromJson( - json['expandedPlayerSettings'] as Map), - preferredDefaultVolume: - (json['preferredDefaultVolume'] as num?)?.toDouble(), - preferredDefaultSpeed: - (json['preferredDefaultSpeed'] as num?)?.toDouble(), - speedOptions: (json['speedOptions'] as List?) - ?.map((e) => (e as num).toDouble()) - .toList(), - sleepTimerSettings: json['sleepTimerSettings'] == null - ? null - : SleepTimerSettings.fromJson( - json['sleepTimerSettings'] as Map), - playbackReportInterval: json['playbackReportInterval'] == null - ? null - : Duration( - microseconds: (json['playbackReportInterval'] as num).toInt()), - ); +_NullablePlayerSettings _$NullablePlayerSettingsFromJson( + Map json, +) => _NullablePlayerSettings( + miniPlayerSettings: json['miniPlayerSettings'] == null + ? null + : MinimizedPlayerSettings.fromJson( + json['miniPlayerSettings'] as Map, + ), + expandedPlayerSettings: json['expandedPlayerSettings'] == null + ? null + : ExpandedPlayerSettings.fromJson( + json['expandedPlayerSettings'] as Map, + ), + preferredDefaultVolume: (json['preferredDefaultVolume'] as num?)?.toDouble(), + preferredDefaultSpeed: (json['preferredDefaultSpeed'] as num?)?.toDouble(), + speedOptions: (json['speedOptions'] as List?) + ?.map((e) => (e as num).toDouble()) + .toList(), + sleepTimerSettings: json['sleepTimerSettings'] == null + ? null + : SleepTimerSettings.fromJson( + json['sleepTimerSettings'] as Map, + ), + playbackReportInterval: json['playbackReportInterval'] == null + ? null + : Duration(microseconds: (json['playbackReportInterval'] as num).toInt()), +); -Map _$$NullablePlayerSettingsImplToJson( - _$NullablePlayerSettingsImpl instance) => - { - 'miniPlayerSettings': instance.miniPlayerSettings, - 'expandedPlayerSettings': instance.expandedPlayerSettings, - 'preferredDefaultVolume': instance.preferredDefaultVolume, - 'preferredDefaultSpeed': instance.preferredDefaultSpeed, - 'speedOptions': instance.speedOptions, - 'sleepTimerSettings': instance.sleepTimerSettings, - 'playbackReportInterval': instance.playbackReportInterval?.inMicroseconds, - }; +Map _$NullablePlayerSettingsToJson( + _NullablePlayerSettings instance, +) => { + 'miniPlayerSettings': instance.miniPlayerSettings, + 'expandedPlayerSettings': instance.expandedPlayerSettings, + 'preferredDefaultVolume': instance.preferredDefaultVolume, + 'preferredDefaultSpeed': instance.preferredDefaultSpeed, + 'speedOptions': instance.speedOptions, + 'sleepTimerSettings': instance.sleepTimerSettings, + 'playbackReportInterval': instance.playbackReportInterval?.inMicroseconds, +}; diff --git a/lib/features/per_book_settings/providers/book_settings_provider.g.dart b/lib/features/per_book_settings/providers/book_settings_provider.g.dart index 221433f..b8ed222 100644 --- a/lib/features/per_book_settings/providers/book_settings_provider.g.dart +++ b/lib/features/per_book_settings/providers/book_settings_provider.g.dart @@ -6,171 +6,102 @@ part of 'book_settings_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$bookSettingsHash() => r'b976df954edf98ec6ccb3eb41e9d07dd4a9193eb'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$BookSettings - extends BuildlessAutoDisposeNotifier { - late final String bookId; - - model.BookSettings build( - String bookId, - ); -} - -/// See also [BookSettings]. @ProviderFor(BookSettings) -const bookSettingsProvider = BookSettingsFamily(); +final bookSettingsProvider = BookSettingsFamily._(); -/// See also [BookSettings]. -class BookSettingsFamily extends Family { - /// See also [BookSettings]. - const BookSettingsFamily(); +final class BookSettingsProvider + extends $NotifierProvider { + BookSettingsProvider._({ + required BookSettingsFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'bookSettingsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [BookSettings]. - BookSettingsProvider call( - String bookId, - ) { - return BookSettingsProvider( - bookId, - ); + @override + String debugGetCreateSourceHash() => _$bookSettingsHash(); + + @override + String toString() { + return r'bookSettingsProvider' + '' + '($argument)'; } + @$internal @override - BookSettingsProvider getProviderOverride( - covariant BookSettingsProvider provider, - ) { - return call( - provider.bookId, - ); - } + BookSettings create() => BookSettings(); - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'bookSettingsProvider'; -} - -/// See also [BookSettings]. -class BookSettingsProvider - extends AutoDisposeNotifierProviderImpl { - /// See also [BookSettings]. - BookSettingsProvider( - String bookId, - ) : this._internal( - () => BookSettings()..bookId = bookId, - from: bookSettingsProvider, - name: r'bookSettingsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$bookSettingsHash, - dependencies: BookSettingsFamily._dependencies, - allTransitiveDependencies: - BookSettingsFamily._allTransitiveDependencies, - bookId: bookId, - ); - - BookSettingsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.bookId, - }) : super.internal(); - - final String bookId; - - @override - model.BookSettings runNotifierBuild( - covariant BookSettings notifier, - ) { - return notifier.build( - bookId, - ); - } - - @override - Override overrideWith(BookSettings Function() create) { - return ProviderOverride( + /// {@macro riverpod.override_with_value} + Override overrideWithValue(model.BookSettings value) { + return $ProviderOverride( origin: this, - override: BookSettingsProvider._internal( - () => create()..bookId = bookId, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - bookId: bookId, - ), + providerOverride: $SyncValueProvider(value), ); } - @override - AutoDisposeNotifierProviderElement - createElement() { - return _BookSettingsProviderElement(this); - } - @override bool operator ==(Object other) { - return other is BookSettingsProvider && other.bookId == bookId; + return other is BookSettingsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, bookId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin BookSettingsRef on AutoDisposeNotifierProviderRef { - /// The parameter `bookId` of this provider. - String get bookId; -} +String _$bookSettingsHash() => r'b976df954edf98ec6ccb3eb41e9d07dd4a9193eb'; -class _BookSettingsProviderElement - extends AutoDisposeNotifierProviderElement - with BookSettingsRef { - _BookSettingsProviderElement(super.provider); +final class BookSettingsFamily extends $Family + with + $ClassFamilyOverride< + BookSettings, + model.BookSettings, + model.BookSettings, + model.BookSettings, + String + > { + BookSettingsFamily._() + : super( + retry: null, + name: r'bookSettingsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + BookSettingsProvider call(String bookId) => + BookSettingsProvider._(argument: bookId, from: this); @override - String get bookId => (origin as BookSettingsProvider).bookId; + String toString() => r'bookSettingsProvider'; +} + +abstract class _$BookSettings extends $Notifier { + late final _$args = ref.$arg as String; + String get bookId => _$args; + + model.BookSettings build(String bookId); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + model.BookSettings, + Object?, + Object? + >; + element.handleCreate(ref, () => build(_$args)); + } } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/features/playback_reporting/providers/playback_reporter_provider.g.dart b/lib/features/playback_reporting/providers/playback_reporter_provider.g.dart index 3c21f16..e017dbb 100644 --- a/lib/features/playback_reporting/providers/playback_reporter_provider.g.dart +++ b/lib/features/playback_reporting/providers/playback_reporter_provider.g.dart @@ -6,21 +6,55 @@ part of 'playback_reporter_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(PlaybackReporter) +final playbackReporterProvider = PlaybackReporterProvider._(); + +final class PlaybackReporterProvider + extends $AsyncNotifierProvider { + PlaybackReporterProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'playbackReporterProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$playbackReporterHash(); + + @$internal + @override + PlaybackReporter create() => PlaybackReporter(); +} + String _$playbackReporterHash() => r'f5436d652e51c37bcc684acdaec94e17a97e68e5'; -/// See also [PlaybackReporter]. -@ProviderFor(PlaybackReporter) -final playbackReporterProvider = - AsyncNotifierProvider.internal( - PlaybackReporter.new, - name: r'playbackReporterProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$playbackReporterHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$PlaybackReporter = AsyncNotifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$PlaybackReporter + extends $AsyncNotifier { + FutureOr build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref + as $Ref, core.PlaybackReporter>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + AsyncValue, + core.PlaybackReporter + >, + AsyncValue, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/player/playlist_provider.g.dart b/lib/features/player/playlist_provider.g.dart index abf7c33..2baca58 100644 --- a/lib/features/player/playlist_provider.g.dart +++ b/lib/features/player/playlist_provider.g.dart @@ -6,20 +6,57 @@ part of 'playlist_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(Playlist) +final playlistProvider = PlaylistProvider._(); + +final class PlaylistProvider + extends $NotifierProvider { + PlaylistProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'playlistProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$playlistHash(); + + @$internal + @override + Playlist create() => Playlist(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(AudiobookPlaylist value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$playlistHash() => r'bed4642e4c2de829e4d0630cb5bf92bffeeb1f60'; -/// See also [Playlist]. -@ProviderFor(Playlist) -final playlistProvider = - AutoDisposeNotifierProvider.internal( - Playlist.new, - name: r'playlistProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$playlistHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$Playlist = AutoDisposeNotifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$Playlist extends $Notifier { + AudiobookPlaylist build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + AudiobookPlaylist, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/player/providers/audiobook_player.g.dart b/lib/features/player/providers/audiobook_player.g.dart index d38dd30..900fd73 100644 --- a/lib/features/player/providers/audiobook_player.g.dart +++ b/lib/features/player/providers/audiobook_player.g.dart @@ -6,41 +6,119 @@ part of 'audiobook_player.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning +/// Simple because it doesn't rebuild when the player state changes +/// it only rebuilds when the token changes + +@ProviderFor(SimpleAudiobookPlayer) +final simpleAudiobookPlayerProvider = SimpleAudiobookPlayerProvider._(); + +/// Simple because it doesn't rebuild when the player state changes +/// it only rebuilds when the token changes +final class SimpleAudiobookPlayerProvider + extends $NotifierProvider { + /// Simple because it doesn't rebuild when the player state changes + /// it only rebuilds when the token changes + SimpleAudiobookPlayerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'simpleAudiobookPlayerProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$simpleAudiobookPlayerHash(); + + @$internal + @override + SimpleAudiobookPlayer create() => SimpleAudiobookPlayer(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.AudiobookPlayer value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$simpleAudiobookPlayerHash() => r'5e94bbff4314adceb5affa704fc4d079d4016afa'; /// Simple because it doesn't rebuild when the player state changes /// it only rebuilds when the token changes -/// -/// Copied from [SimpleAudiobookPlayer]. -@ProviderFor(SimpleAudiobookPlayer) -final simpleAudiobookPlayerProvider = - NotifierProvider.internal( - SimpleAudiobookPlayer.new, - name: r'simpleAudiobookPlayerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$simpleAudiobookPlayerHash, - dependencies: null, - allTransitiveDependencies: null, -); -typedef _$SimpleAudiobookPlayer = Notifier; +abstract class _$SimpleAudiobookPlayer extends $Notifier { + core.AudiobookPlayer build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + core.AudiobookPlayer, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} + +@ProviderFor(AudiobookPlayer) +final audiobookPlayerProvider = AudiobookPlayerProvider._(); + +final class AudiobookPlayerProvider + extends $NotifierProvider { + AudiobookPlayerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'audiobookPlayerProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$audiobookPlayerHash(); + + @$internal + @override + AudiobookPlayer create() => AudiobookPlayer(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.AudiobookPlayer value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$audiobookPlayerHash() => r'0f180308067486896fec6a65a6afb0e6686ac4a0'; -/// See also [AudiobookPlayer]. -@ProviderFor(AudiobookPlayer) -final audiobookPlayerProvider = - NotifierProvider.internal( - AudiobookPlayer.new, - name: r'audiobookPlayerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$audiobookPlayerHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$AudiobookPlayer = Notifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$AudiobookPlayer extends $Notifier { + core.AudiobookPlayer build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + core.AudiobookPlayer, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/player/providers/currently_playing_provider.g.dart b/lib/features/player/providers/currently_playing_provider.g.dart index 428aa0b..f886f8e 100644 --- a/lib/features/player/providers/currently_playing_provider.g.dart +++ b/lib/features/player/providers/currently_playing_provider.g.dart @@ -6,66 +6,147 @@ part of 'currently_playing_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(currentlyPlayingBook) +final currentlyPlayingBookProvider = CurrentlyPlayingBookProvider._(); + +final class CurrentlyPlayingBookProvider + extends $FunctionalProvider + with $Provider { + CurrentlyPlayingBookProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'currentlyPlayingBookProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$currentlyPlayingBookHash(); + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + BookExpanded? create(Ref ref) { + return currentlyPlayingBook(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(BookExpanded? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$currentlyPlayingBookHash() => r'e4258694c8f0d1e89651b330fae0f672ca13a484'; -/// See also [currentlyPlayingBook]. -@ProviderFor(currentlyPlayingBook) -final currentlyPlayingBookProvider = - AutoDisposeProvider.internal( - currentlyPlayingBook, - name: r'currentlyPlayingBookProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$currentlyPlayingBookHash, - dependencies: null, - allTransitiveDependencies: null, -); +/// provided the current chapter of the book being played + +@ProviderFor(currentPlayingChapter) +final currentPlayingChapterProvider = CurrentPlayingChapterProvider._(); + +/// provided the current chapter of the book being played + +final class CurrentPlayingChapterProvider + extends $FunctionalProvider + with $Provider { + /// provided the current chapter of the book being played + CurrentPlayingChapterProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'currentPlayingChapterProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$currentPlayingChapterHash(); + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + BookChapter? create(Ref ref) { + return currentPlayingChapter(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(BookChapter? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CurrentlyPlayingBookRef = AutoDisposeProviderRef; String _$currentPlayingChapterHash() => r'73db8b8a9058573bb0c68ec5d5f8aba9306f3d24'; -/// provided the current chapter of the book being played -/// -/// Copied from [currentPlayingChapter]. -@ProviderFor(currentPlayingChapter) -final currentPlayingChapterProvider = - AutoDisposeProvider.internal( - currentPlayingChapter, - name: r'currentPlayingChapterProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$currentPlayingChapterHash, - dependencies: null, - allTransitiveDependencies: null, -); +/// provides the book metadata of the currently playing book -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CurrentPlayingChapterRef = AutoDisposeProviderRef; -String _$currentBookMetadataHash() => - r'f537ef4ef19280bc952de658ecf6520c535ae344'; +@ProviderFor(currentBookMetadata) +final currentBookMetadataProvider = CurrentBookMetadataProvider._(); /// provides the book metadata of the currently playing book -/// -/// Copied from [currentBookMetadata]. -@ProviderFor(currentBookMetadata) -final currentBookMetadataProvider = - AutoDisposeProvider.internal( - currentBookMetadata, - name: r'currentBookMetadataProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$currentBookMetadataHash, - dependencies: null, - allTransitiveDependencies: null, -); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CurrentBookMetadataRef = AutoDisposeProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class CurrentBookMetadataProvider + extends + $FunctionalProvider< + BookMetadataExpanded?, + BookMetadataExpanded?, + BookMetadataExpanded? + > + with $Provider { + /// provides the book metadata of the currently playing book + CurrentBookMetadataProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'currentBookMetadataProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$currentBookMetadataHash(); + + @$internal + @override + $ProviderElement $createElement( + $ProviderPointer pointer, + ) => $ProviderElement(pointer); + + @override + BookMetadataExpanded? create(Ref ref) { + return currentBookMetadata(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(BookMetadataExpanded? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$currentBookMetadataHash() => + r'f537ef4ef19280bc952de658ecf6520c535ae344'; diff --git a/lib/features/player/providers/player_form.dart b/lib/features/player/providers/player_form.dart index 10376ee..73d6bdc 100644 --- a/lib/features/player/providers/player_form.dart +++ b/lib/features/player/providers/player_form.dart @@ -49,7 +49,7 @@ Raw> playerExpandProgressNotifier( double playerHeight( Ref ref, ) { - final playerExpandProgress = ref.watch(playerExpandProgressNotifierProvider); + final playerExpandProgress = ref.watch(playerExpandProgressProvider); // on change of the playerExpandProgress invalidate playerExpandProgress.addListener(() { diff --git a/lib/features/player/providers/player_form.g.dart b/lib/features/player/providers/player_form.g.dart index 6dcfcf9..b2d17ce 100644 --- a/lib/features/player/providers/player_form.g.dart +++ b/lib/features/player/providers/player_form.g.dart @@ -6,58 +6,134 @@ part of 'player_form.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(playerExpandProgressNotifier) +final playerExpandProgressProvider = PlayerExpandProgressNotifierProvider._(); + +final class PlayerExpandProgressNotifierProvider + extends + $FunctionalProvider< + Raw>, + Raw>, + Raw> + > + with $Provider>> { + PlayerExpandProgressNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'playerExpandProgressProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$playerExpandProgressNotifierHash(); + + @$internal + @override + $ProviderElement>> $createElement( + $ProviderPointer pointer, + ) => $ProviderElement(pointer); + + @override + Raw> create(Ref ref) { + return playerExpandProgressNotifier(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Raw> value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>>(value), + ); + } +} + String _$playerExpandProgressNotifierHash() => r'1ac7172d90a070f96222286edd1a176be197f378'; -/// See also [playerExpandProgressNotifier]. -@ProviderFor(playerExpandProgressNotifier) -final playerExpandProgressNotifierProvider = - Provider>>.internal( - playerExpandProgressNotifier, - name: r'playerExpandProgressNotifierProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$playerExpandProgressNotifierHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef PlayerExpandProgressNotifierRef - = ProviderRef>>; -String _$playerHeightHash() => r'3f031eaffdffbb2c6ddf7eb1aba31bf1619260fc'; - -/// See also [playerHeight]. @ProviderFor(playerHeight) -final playerHeightProvider = Provider.internal( - playerHeight, - name: r'playerHeightProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$playerHeightHash, - dependencies: null, - allTransitiveDependencies: null, -); +final playerHeightProvider = PlayerHeightProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef PlayerHeightRef = ProviderRef; -String _$isPlayerActiveHash() => r'2c7ca125423126fb5f0ef218d37bc8fe0ca9ec98'; +final class PlayerHeightProvider + extends $FunctionalProvider + with $Provider { + PlayerHeightProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'playerHeightProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$playerHeightHash(); + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + double create(Ref ref) { + return playerHeight(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(double value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$playerHeightHash() => r'41144a733b5ffd1c872a237ed7c9ea5f450dd0d4'; -/// See also [isPlayerActive]. @ProviderFor(isPlayerActive) -final isPlayerActiveProvider = Provider.internal( - isPlayerActive, - name: r'isPlayerActiveProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$isPlayerActiveHash, - dependencies: null, - allTransitiveDependencies: null, -); +final isPlayerActiveProvider = IsPlayerActiveProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef IsPlayerActiveRef = ProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class IsPlayerActiveProvider extends $FunctionalProvider + with $Provider { + IsPlayerActiveProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'isPlayerActiveProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$isPlayerActiveHash(); + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + bool create(Ref ref) { + return isPlayerActive(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(bool value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$isPlayerActiveHash() => r'2c7ca125423126fb5f0ef218d37bc8fe0ca9ec98'; diff --git a/lib/features/player/view/audiobook_player.dart b/lib/features/player/view/audiobook_player.dart index 1940ba7..2909a9b 100644 --- a/lib/features/player/view/audiobook_player.dart +++ b/lib/features/player/view/audiobook_player.dart @@ -34,14 +34,14 @@ class AudiobookPlayer extends HookConsumerWidget { final itemBeingPlayed = ref.watch(libraryItemProvider(currentBook.libraryItemId)); final player = ref.watch(audiobookPlayerProvider); - final imageOfItemBeingPlayed = itemBeingPlayed.valueOrNull != null + final imageOfItemBeingPlayed = itemBeingPlayed.value != null ? ref.watch( - coverImageProvider(itemBeingPlayed.valueOrNull!.id), + coverImageProvider(itemBeingPlayed.value!.id), ) : null; - final imgWidget = imageOfItemBeingPlayed?.valueOrNull != null + final imgWidget = imageOfItemBeingPlayed?.value != null ? Image.memory( - imageOfItemBeingPlayed!.valueOrNull!, + imageOfItemBeingPlayed!.value!, fit: BoxFit.cover, ) : const BookCoverSkeleton(); @@ -63,7 +63,7 @@ class AudiobookPlayer extends HookConsumerWidget { // theme from image final imageTheme = ref.watch( themeOfLibraryItemProvider( - itemBeingPlayed.valueOrNull?.id, + itemBeingPlayed.value?.id, brightness: Theme.of(context).brightness, highContrast: appSettings.themeSettings.highContrast || MediaQuery.of(context).highContrast, @@ -81,10 +81,10 @@ class AudiobookPlayer extends HookConsumerWidget { final preferredVolume = appSettings.playerSettings.preferredDefaultVolume; return Theme( data: ThemeData( - colorScheme: imageTheme.valueOrNull ?? Theme.of(context).colorScheme, + colorScheme: imageTheme.value ?? Theme.of(context).colorScheme, ), child: Miniplayer( - valueNotifier: ref.watch(playerExpandProgressNotifierProvider), + valueNotifier: ref.watch(playerExpandProgressProvider), onDragDown: (percentage) async { // preferred volume // set volume to 0 when dragging down diff --git a/lib/features/shake_detection/providers/shake_detector.g.dart b/lib/features/shake_detection/providers/shake_detector.g.dart index ed81aaf..669d6d5 100644 --- a/lib/features/shake_detection/providers/shake_detector.g.dart +++ b/lib/features/shake_detection/providers/shake_detector.g.dart @@ -6,21 +6,57 @@ part of 'shake_detector.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(ShakeDetector) +final shakeDetectorProvider = ShakeDetectorProvider._(); + +final class ShakeDetectorProvider + extends $NotifierProvider { + ShakeDetectorProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'shakeDetectorProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$shakeDetectorHash(); + + @$internal + @override + ShakeDetector create() => ShakeDetector(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.ShakeDetector? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$shakeDetectorHash() => r'2a380bab1d4021d05d2ae40fec964a5f33d3730c'; -/// See also [ShakeDetector]. -@ProviderFor(ShakeDetector) -final shakeDetectorProvider = - AutoDisposeNotifierProvider.internal( - ShakeDetector.new, - name: r'shakeDetectorProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$shakeDetectorHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$ShakeDetector = AutoDisposeNotifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$ShakeDetector extends $Notifier { + core.ShakeDetector? build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + core.ShakeDetector?, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/features/sleep_timer/providers/sleep_timer_provider.g.dart b/lib/features/sleep_timer/providers/sleep_timer_provider.g.dart index 0b1db3f..a3b0e3e 100644 --- a/lib/features/sleep_timer/providers/sleep_timer_provider.g.dart +++ b/lib/features/sleep_timer/providers/sleep_timer_provider.g.dart @@ -6,20 +6,57 @@ part of 'sleep_timer_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(SleepTimer) +final sleepTimerProvider = SleepTimerProvider._(); + +final class SleepTimerProvider + extends $NotifierProvider { + SleepTimerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'sleepTimerProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$sleepTimerHash(); + + @$internal + @override + SleepTimer create() => SleepTimer(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(core.SleepTimer? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$sleepTimerHash() => r'2679454a217d0630a833d730557ab4e4feac2e56'; -/// See also [SleepTimer]. -@ProviderFor(SleepTimer) -final sleepTimerProvider = - NotifierProvider.internal( - SleepTimer.new, - name: r'sleepTimerProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$sleepTimerHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$SleepTimer = Notifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$SleepTimer extends $Notifier { + core.SleepTimer? build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + core.SleepTimer?, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/main.dart b/lib/main.dart index 6020a6a..b67d8a9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -76,9 +76,9 @@ class MyApp extends ConsumerWidget { if (themeSettings.useMaterialThemeFromSystem) { var themes = ref.watch(systemThemeProvider(highContrast: shouldUseHighContrast)); - if (themes.valueOrNull != null) { - lightColorScheme = themes.valueOrNull!.$1; - darkColorScheme = themes.valueOrNull!.$2; + if (themes.value != null) { + lightColorScheme = themes.value!.$1; + darkColorScheme = themes.value!.$2; } } @@ -100,9 +100,9 @@ class MyApp extends ConsumerWidget { brightness: Brightness.dark, ), ); - if (themeLight.valueOrNull != null && themeDark.valueOrNull != null) { - lightColorScheme = themeLight.valueOrNull!; - darkColorScheme = themeDark.valueOrNull!; + if (themeLight.value != null && themeDark.value != null) { + lightColorScheme = themeLight.value!; + darkColorScheme = themeDark.value!; } } } catch (e) { diff --git a/lib/router/models/library_item_extras.dart b/lib/router/models/library_item_extras.dart index 55b734e..e67a508 100644 --- a/lib/router/models/library_item_extras.dart +++ b/lib/router/models/library_item_extras.dart @@ -11,7 +11,7 @@ part 'library_item_extras.freezed.dart'; /// [book] is the book that the item represents /// [heroTagSuffix] is the suffix to use for the hero tag to avoid conflicts @freezed -class LibraryItemExtras with _$LibraryItemExtras { +sealed class LibraryItemExtras with _$LibraryItemExtras { const factory LibraryItemExtras({ BookMinified? book, @Default('') String heroTagSuffix, diff --git a/lib/router/models/library_item_extras.freezed.dart b/lib/router/models/library_item_extras.freezed.dart index 900fdec..fe6ae17 100644 --- a/lib/router/models/library_item_extras.freezed.dart +++ b/lib/router/models/library_item_extras.freezed.dart @@ -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,156 +9,260 @@ part of 'library_item_extras.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(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 _$LibraryItemExtras { - BookMinified? get book => throw _privateConstructorUsedError; - String get heroTagSuffix => throw _privateConstructorUsedError; - /// Create a copy of LibraryItemExtras - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $LibraryItemExtrasCopyWith get copyWith => - throw _privateConstructorUsedError; + BookMinified? get book; String get heroTagSuffix; +/// Create a copy of LibraryItemExtras +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LibraryItemExtrasCopyWith get copyWith => _$LibraryItemExtrasCopyWithImpl(this as LibraryItemExtras, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LibraryItemExtras&&(identical(other.book, book) || other.book == book)&&(identical(other.heroTagSuffix, heroTagSuffix) || other.heroTagSuffix == heroTagSuffix)); +} + + +@override +int get hashCode => Object.hash(runtimeType,book,heroTagSuffix); + +@override +String toString() { + return 'LibraryItemExtras(book: $book, heroTagSuffix: $heroTagSuffix)'; +} + + } /// @nodoc -abstract class $LibraryItemExtrasCopyWith<$Res> { - factory $LibraryItemExtrasCopyWith( - LibraryItemExtras value, $Res Function(LibraryItemExtras) then) = - _$LibraryItemExtrasCopyWithImpl<$Res, LibraryItemExtras>; - @useResult - $Res call({BookMinified? book, String heroTagSuffix}); -} +abstract mixin class $LibraryItemExtrasCopyWith<$Res> { + factory $LibraryItemExtrasCopyWith(LibraryItemExtras value, $Res Function(LibraryItemExtras) _then) = _$LibraryItemExtrasCopyWithImpl; +@useResult +$Res call({ + BookMinified? book, String heroTagSuffix +}); + + + +} /// @nodoc -class _$LibraryItemExtrasCopyWithImpl<$Res, $Val extends LibraryItemExtras> +class _$LibraryItemExtrasCopyWithImpl<$Res> implements $LibraryItemExtrasCopyWith<$Res> { - _$LibraryItemExtrasCopyWithImpl(this._value, this._then); + _$LibraryItemExtrasCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final LibraryItemExtras _self; + final $Res Function(LibraryItemExtras) _then; - /// Create a copy of LibraryItemExtras - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? book = freezed, - Object? heroTagSuffix = null, - }) { - return _then(_value.copyWith( - book: freezed == book - ? _value.book - : book // ignore: cast_nullable_to_non_nullable - as BookMinified?, - heroTagSuffix: null == heroTagSuffix - ? _value.heroTagSuffix - : heroTagSuffix // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of LibraryItemExtras +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? book = freezed,Object? heroTagSuffix = null,}) { + return _then(_self.copyWith( +book: freezed == book ? _self.book : book // ignore: cast_nullable_to_non_nullable +as BookMinified?,heroTagSuffix: null == heroTagSuffix ? _self.heroTagSuffix : heroTagSuffix // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$LibraryItemExtrasImplCopyWith<$Res> - implements $LibraryItemExtrasCopyWith<$Res> { - factory _$$LibraryItemExtrasImplCopyWith(_$LibraryItemExtrasImpl value, - $Res Function(_$LibraryItemExtrasImpl) then) = - __$$LibraryItemExtrasImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({BookMinified? book, String heroTagSuffix}); } -/// @nodoc -class __$$LibraryItemExtrasImplCopyWithImpl<$Res> - extends _$LibraryItemExtrasCopyWithImpl<$Res, _$LibraryItemExtrasImpl> - implements _$$LibraryItemExtrasImplCopyWith<$Res> { - __$$LibraryItemExtrasImplCopyWithImpl(_$LibraryItemExtrasImpl _value, - $Res Function(_$LibraryItemExtrasImpl) _then) - : super(_value, _then); - /// Create a copy of LibraryItemExtras - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? book = freezed, - Object? heroTagSuffix = null, - }) { - return _then(_$LibraryItemExtrasImpl( - book: freezed == book - ? _value.book - : book // ignore: cast_nullable_to_non_nullable - as BookMinified?, - heroTagSuffix: null == heroTagSuffix - ? _value.heroTagSuffix - : heroTagSuffix // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [LibraryItemExtras]. +extension LibraryItemExtrasPatterns on LibraryItemExtras { +/// 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 Function( _LibraryItemExtras value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LibraryItemExtras() 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 Function( _LibraryItemExtras value) $default,){ +final _that = this; +switch (_that) { +case _LibraryItemExtras(): +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? Function( _LibraryItemExtras value)? $default,){ +final _that = this; +switch (_that) { +case _LibraryItemExtras() 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 Function( BookMinified? book, String heroTagSuffix)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LibraryItemExtras() when $default != null: +return $default(_that.book,_that.heroTagSuffix);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 Function( BookMinified? book, String heroTagSuffix) $default,) {final _that = this; +switch (_that) { +case _LibraryItemExtras(): +return $default(_that.book,_that.heroTagSuffix);} +} +/// 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? Function( BookMinified? book, String heroTagSuffix)? $default,) {final _that = this; +switch (_that) { +case _LibraryItemExtras() when $default != null: +return $default(_that.book,_that.heroTagSuffix);case _: + return null; + +} +} + } /// @nodoc -class _$LibraryItemExtrasImpl implements _LibraryItemExtras { - const _$LibraryItemExtrasImpl({this.book, this.heroTagSuffix = ''}); - @override - final BookMinified? book; - @override - @JsonKey() - final String heroTagSuffix; +class _LibraryItemExtras implements LibraryItemExtras { + const _LibraryItemExtras({this.book, this.heroTagSuffix = ''}); + - @override - String toString() { - return 'LibraryItemExtras(book: $book, heroTagSuffix: $heroTagSuffix)'; - } +@override final BookMinified? book; +@override@JsonKey() final String heroTagSuffix; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LibraryItemExtrasImpl && - (identical(other.book, book) || other.book == book) && - (identical(other.heroTagSuffix, heroTagSuffix) || - other.heroTagSuffix == heroTagSuffix)); - } +/// Create a copy of LibraryItemExtras +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LibraryItemExtrasCopyWith<_LibraryItemExtras> get copyWith => __$LibraryItemExtrasCopyWithImpl<_LibraryItemExtras>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, book, heroTagSuffix); - /// Create a copy of LibraryItemExtras - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$LibraryItemExtrasImplCopyWith<_$LibraryItemExtrasImpl> get copyWith => - __$$LibraryItemExtrasImplCopyWithImpl<_$LibraryItemExtrasImpl>( - this, _$identity); + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LibraryItemExtras&&(identical(other.book, book) || other.book == book)&&(identical(other.heroTagSuffix, heroTagSuffix) || other.heroTagSuffix == heroTagSuffix)); } -abstract class _LibraryItemExtras implements LibraryItemExtras { - const factory _LibraryItemExtras( - {final BookMinified? book, - final String heroTagSuffix}) = _$LibraryItemExtrasImpl; - @override - BookMinified? get book; - @override - String get heroTagSuffix; +@override +int get hashCode => Object.hash(runtimeType,book,heroTagSuffix); - /// Create a copy of LibraryItemExtras - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$LibraryItemExtrasImplCopyWith<_$LibraryItemExtrasImpl> get copyWith => - throw _privateConstructorUsedError; +@override +String toString() { + return 'LibraryItemExtras(book: $book, heroTagSuffix: $heroTagSuffix)'; } + + +} + +/// @nodoc +abstract mixin class _$LibraryItemExtrasCopyWith<$Res> implements $LibraryItemExtrasCopyWith<$Res> { + factory _$LibraryItemExtrasCopyWith(_LibraryItemExtras value, $Res Function(_LibraryItemExtras) _then) = __$LibraryItemExtrasCopyWithImpl; +@override @useResult +$Res call({ + BookMinified? book, String heroTagSuffix +}); + + + + +} +/// @nodoc +class __$LibraryItemExtrasCopyWithImpl<$Res> + implements _$LibraryItemExtrasCopyWith<$Res> { + __$LibraryItemExtrasCopyWithImpl(this._self, this._then); + + final _LibraryItemExtras _self; + final $Res Function(_LibraryItemExtras) _then; + +/// Create a copy of LibraryItemExtras +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? book = freezed,Object? heroTagSuffix = null,}) { + return _then(_LibraryItemExtras( +book: freezed == book ? _self.book : book // ignore: cast_nullable_to_non_nullable +as BookMinified?,heroTagSuffix: null == heroTagSuffix ? _self.heroTagSuffix : heroTagSuffix // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/lib/router/scaffold_with_nav_bar.dart b/lib/router/scaffold_with_nav_bar.dart index 27c3355..5f0b026 100644 --- a/lib/router/scaffold_with_nav_bar.dart +++ b/lib/router/scaffold_with_nav_bar.dart @@ -23,10 +23,8 @@ const bottomBarHeight = 64; /// BottomNavigationBar, where [child] is placed in the body of the Scaffold. class ScaffoldWithNavBar extends HookConsumerWidget { /// Constructs an [ScaffoldWithNavBar]. - const ScaffoldWithNavBar({ - required this.navigationShell, - Key? key, - }) : super(key: key ?? const ValueKey('ScaffoldWithNavBar')); + const ScaffoldWithNavBar({required this.navigationShell, Key? key}) + : super(key: key ?? const ValueKey('ScaffoldWithNavBar')); /// The navigation shell and container for the branch Navigators. final StatefulNavigationShell navigationShell; @@ -35,10 +33,11 @@ class ScaffoldWithNavBar extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { // playerExpandProgress is used to animate bottom navigation bar to opacity 0 and slide down when player is expanded // final playerProgress = - // useValueListenable(ref.watch(playerExpandProgressNotifierProvider)); + // useValueListenable(ref.watch(playerExpandProgressProvider)); final playerProgress = ref.watch(playerHeightProvider); final playerMaxHeight = MediaQuery.of(context).size.height; - var percentExpandedMiniPlayer = (playerProgress - playerMinHeight) / + var percentExpandedMiniPlayer = + (playerProgress - playerMinHeight) / (playerMaxHeight - playerMinHeight); // Clamp the value between 0 and 1 percentExpandedMiniPlayer = percentExpandedMiniPlayer.clamp(0.0, 1.0); @@ -52,9 +51,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget { // close miniplayer if it is open if (isPlayerExpanded && pendingPlayerModals == 0) { - appLogger.fine( - 'BackButtonListener: closing the player', - ); + appLogger.fine('BackButtonListener: closing the player'); audioBookMiniplayerController.animateToHeight(state: PanelState.MIN); return true; } @@ -96,12 +93,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget { return BackButtonListener( onBackButtonPressed: onBackButtonPressed, child: Scaffold( - body: Stack( - children: [ - navigationShell, - const AudiobookPlayer(), - ], - ), + body: Stack(children: [navigationShell, const AudiobookPlayer()]), bottomNavigationBar: Opacity( // Opacity is interpolated from 1 to 0 when player is expanded opacity: 1 - percentExpandedMiniPlayer, @@ -116,11 +108,8 @@ class ScaffoldWithNavBar extends HookConsumerWidget { // `navigationShell.route.branches`. destinations: _navigationItems.map((item) { final isDestinationLibrary = item.name == 'Library'; - var currentLibrary = - ref.watch(currentLibraryProvider).valueOrNull; - final libraryIcon = AbsIcons.getIconByName( - currentLibrary?.icon, - ); + var currentLibrary = ref.watch(currentLibraryProvider).value; + final libraryIcon = AbsIcons.getIconByName(currentLibrary?.icon); final destinationWidget = NavigationDestination( icon: Icon( isDestinationLibrary ? libraryIcon ?? item.icon : item.icon, diff --git a/lib/settings/api_settings_provider.dart b/lib/settings/api_settings_provider.dart index 91334f0..132ac7b 100644 --- a/lib/settings/api_settings_provider.dart +++ b/lib/settings/api_settings_provider.dart @@ -17,7 +17,7 @@ class ApiSettings extends _$ApiSettings { @override model.ApiSettings build() { state = readFromBoxOrCreate(); - ref.listenSelf((_, __) { + listenSelf((_, __) { writeToBox(); }); diff --git a/lib/settings/api_settings_provider.g.dart b/lib/settings/api_settings_provider.g.dart index eff1d41..752dfcc 100644 --- a/lib/settings/api_settings_provider.g.dart +++ b/lib/settings/api_settings_provider.g.dart @@ -6,20 +6,57 @@ part of 'api_settings_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$apiSettingsHash() => r'5bc1e16e9d72b77fb10637aabadf08e8947da580'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [ApiSettings]. @ProviderFor(ApiSettings) -final apiSettingsProvider = - NotifierProvider.internal( - ApiSettings.new, - name: r'apiSettingsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$apiSettingsHash, - dependencies: null, - allTransitiveDependencies: null, -); +final apiSettingsProvider = ApiSettingsProvider._(); -typedef _$ApiSettings = Notifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class ApiSettingsProvider + extends $NotifierProvider { + ApiSettingsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'apiSettingsProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$apiSettingsHash(); + + @$internal + @override + ApiSettings create() => ApiSettings(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(model.ApiSettings value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$apiSettingsHash() => r'02af850985338eade33d76fc9965808bed548290'; + +abstract class _$ApiSettings extends $Notifier { + model.ApiSettings build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + model.ApiSettings, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/settings/app_settings_provider.dart b/lib/settings/app_settings_provider.dart index b86e736..fc10f9a 100644 --- a/lib/settings/app_settings_provider.dart +++ b/lib/settings/app_settings_provider.dart @@ -34,7 +34,7 @@ class AppSettings extends _$AppSettings { @override model.AppSettings build() { state = loadOrCreateAppSettings(); - ref.listenSelf((_, __) { + listenSelf((_, __) { writeToBox(); }); return state; diff --git a/lib/settings/app_settings_provider.g.dart b/lib/settings/app_settings_provider.g.dart index 8f3d8f5..8cb4a0f 100644 --- a/lib/settings/app_settings_provider.g.dart +++ b/lib/settings/app_settings_provider.g.dart @@ -6,37 +6,112 @@ part of 'app_settings_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$appSettingsHash() => r'314d7936f54550f57d308056a99230402342a6d0'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [AppSettings]. @ProviderFor(AppSettings) -final appSettingsProvider = - NotifierProvider.internal( - AppSettings.new, - name: r'appSettingsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$appSettingsHash, - dependencies: null, - allTransitiveDependencies: null, -); +final appSettingsProvider = AppSettingsProvider._(); + +final class AppSettingsProvider + extends $NotifierProvider { + AppSettingsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'appSettingsProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$appSettingsHash(); + + @$internal + @override + AppSettings create() => AppSettings(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(model.AppSettings value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$appSettingsHash() => r'744d7e0157eb3b089c4187b35b845fc78547a44e'; + +abstract class _$AppSettings extends $Notifier { + model.AppSettings build(); + @$mustCallSuper + @override + void runBuild() { + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + model.AppSettings, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} + +@ProviderFor(SleepTimerSettings) +final sleepTimerSettingsProvider = SleepTimerSettingsProvider._(); + +final class SleepTimerSettingsProvider + extends $NotifierProvider { + SleepTimerSettingsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'sleepTimerSettingsProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$sleepTimerSettingsHash(); + + @$internal + @override + SleepTimerSettings create() => SleepTimerSettings(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(model.SleepTimerSettings value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} -typedef _$AppSettings = Notifier; String _$sleepTimerSettingsHash() => r'85bb3d3fb292b9a3a5b771d86e5fc57718519c69'; -/// See also [SleepTimerSettings]. -@ProviderFor(SleepTimerSettings) -final sleepTimerSettingsProvider = - NotifierProvider.internal( - SleepTimerSettings.new, - name: r'sleepTimerSettingsProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$sleepTimerSettingsHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$SleepTimerSettings = Notifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$SleepTimerSettings + extends $Notifier { + model.SleepTimerSettings build(); + @$mustCallSuper + @override + void runBuild() { + final ref = + this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + model.SleepTimerSettings, + Object?, + Object? + >; + element.handleCreate(ref, build); + } +} diff --git a/lib/settings/metadata/metadata_provider.g.dart b/lib/settings/metadata/metadata_provider.g.dart index b83c0f0..50c6f1f 100644 --- a/lib/settings/metadata/metadata_provider.g.dart +++ b/lib/settings/metadata/metadata_provider.g.dart @@ -6,72 +6,138 @@ part of 'metadata_provider.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(deviceName) +final deviceNameProvider = DeviceNameProvider._(); + +final class DeviceNameProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + DeviceNameProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'deviceNameProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$deviceNameHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return deviceName(ref); + } +} + String _$deviceNameHash() => r'9e38adda74e70a91851a682f05228bd759356dcc'; -/// See also [deviceName]. -@ProviderFor(deviceName) -final deviceNameProvider = FutureProvider.internal( - deviceName, - name: r'deviceNameProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$deviceNameHash, - dependencies: null, - allTransitiveDependencies: null, -); +@ProviderFor(deviceModel) +final deviceModelProvider = DeviceModelProvider._(); + +final class DeviceModelProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + DeviceModelProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'deviceModelProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$deviceModelHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return deviceModel(ref); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef DeviceNameRef = FutureProviderRef; String _$deviceModelHash() => r'922b13d9e35b5b5c5b8e96f2f2c2ae594f4f41f2'; -/// See also [deviceModel]. -@ProviderFor(deviceModel) -final deviceModelProvider = FutureProvider.internal( - deviceModel, - name: r'deviceModelProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$deviceModelHash, - dependencies: null, - allTransitiveDependencies: null, -); +@ProviderFor(deviceSdkVersion) +final deviceSdkVersionProvider = DeviceSdkVersionProvider._(); + +final class DeviceSdkVersionProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + DeviceSdkVersionProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'deviceSdkVersionProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$deviceSdkVersionHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return deviceSdkVersion(ref); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef DeviceModelRef = FutureProviderRef; String _$deviceSdkVersionHash() => r'33178d80590808d1f4cca2be8a3b52c6f6724cac'; -/// See also [deviceSdkVersion]. -@ProviderFor(deviceSdkVersion) -final deviceSdkVersionProvider = FutureProvider.internal( - deviceSdkVersion, - name: r'deviceSdkVersionProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$deviceSdkVersionHash, - dependencies: null, - allTransitiveDependencies: null, -); +@ProviderFor(deviceManufacturer) +final deviceManufacturerProvider = DeviceManufacturerProvider._(); + +final class DeviceManufacturerProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + DeviceManufacturerProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'deviceManufacturerProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$deviceManufacturerHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return deviceManufacturer(ref); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef DeviceSdkVersionRef = FutureProviderRef; String _$deviceManufacturerHash() => r'39250767deb8635fa7c7e18bae23576b9b863e04'; - -/// See also [deviceManufacturer]. -@ProviderFor(deviceManufacturer) -final deviceManufacturerProvider = FutureProvider.internal( - deviceManufacturer, - name: r'deviceManufacturerProvider', - debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') - ? null - : _$deviceManufacturerHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef DeviceManufacturerRef = FutureProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/settings/models/api_settings.dart b/lib/settings/models/api_settings.dart index 6410938..dd7aada 100644 --- a/lib/settings/models/api_settings.dart +++ b/lib/settings/models/api_settings.dart @@ -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, diff --git a/lib/settings/models/api_settings.freezed.dart b/lib/settings/models/api_settings.freezed.dart index 2f3c6e5..6669a2b 100644 --- a/lib/settings/models/api_settings.freezed.dart +++ b/lib/settings/models/api_settings.freezed.dart @@ -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 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 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 get copyWith => _$ApiSettingsCopyWithImpl(this as ApiSettings, _$identity); /// Serializes this ApiSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map 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 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 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 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? 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 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 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? 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 json) => - _$$ApiSettingsImplFromJson(json); +class _ApiSettings implements ApiSettings { + const _ApiSettings({this.activeServer, this.activeUser, this.activeLibraryId}); + factory _ApiSettings.fromJson(Map 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 toJson() { - return _$$ApiSettingsImplToJson( - this, - ); - } +@override +Map 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 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 diff --git a/lib/settings/models/api_settings.g.dart b/lib/settings/models/api_settings.g.dart index 568754a..13b6359 100644 --- a/lib/settings/models/api_settings.g.dart +++ b/lib/settings/models/api_settings.g.dart @@ -6,20 +6,19 @@ part of 'api_settings.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ApiSettingsImpl _$$ApiSettingsImplFromJson(Map json) => - _$ApiSettingsImpl( - activeServer: json['activeServer'] == null - ? null - : AudiobookShelfServer.fromJson( - json['activeServer'] as Map), - activeUser: json['activeUser'] == null - ? null - : AuthenticatedUser.fromJson( - json['activeUser'] as Map), - activeLibraryId: json['activeLibraryId'] as String?, - ); +_ApiSettings _$ApiSettingsFromJson(Map json) => _ApiSettings( + activeServer: json['activeServer'] == null + ? null + : AudiobookShelfServer.fromJson( + json['activeServer'] as Map, + ), + activeUser: json['activeUser'] == null + ? null + : AuthenticatedUser.fromJson(json['activeUser'] as Map), + activeLibraryId: json['activeLibraryId'] as String?, +); -Map _$$ApiSettingsImplToJson(_$ApiSettingsImpl instance) => +Map _$ApiSettingsToJson(_ApiSettings instance) => { 'activeServer': instance.activeServer, 'activeUser': instance.activeUser, diff --git a/lib/settings/models/app_settings.dart b/lib/settings/models/app_settings.dart index fe1f7be..41fddd0 100644 --- a/lib/settings/models/app_settings.dart +++ b/lib/settings/models/app_settings.dart @@ -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 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 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 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, diff --git a/lib/settings/models/app_settings.freezed.dart b/lib/settings/models/app_settings.freezed.dart index 17dea47..3d17503 100644 --- a/lib/settings/models/app_settings.freezed.dart +++ b/lib/settings/models/app_settings.freezed.dart @@ -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,3102 +9,2951 @@ part of 'app_settings.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(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'); - -AppSettings _$AppSettingsFromJson(Map json) { - return _AppSettings.fromJson(json); -} - /// @nodoc mixin _$AppSettings { - ThemeSettings get themeSettings => throw _privateConstructorUsedError; - PlayerSettings get playerSettings => throw _privateConstructorUsedError; - SleepTimerSettings get sleepTimerSettings => - throw _privateConstructorUsedError; - DownloadSettings get downloadSettings => throw _privateConstructorUsedError; - NotificationSettings get notificationSettings => - throw _privateConstructorUsedError; - ShakeDetectionSettings get shakeDetectionSettings => - throw _privateConstructorUsedError; - HomePageSettings get homePageSettings => throw _privateConstructorUsedError; + + ThemeSettings get themeSettings; PlayerSettings get playerSettings; SleepTimerSettings get sleepTimerSettings; DownloadSettings get downloadSettings; NotificationSettings get notificationSettings; ShakeDetectionSettings get shakeDetectionSettings; HomePageSettings get homePageSettings; +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AppSettingsCopyWith get copyWith => _$AppSettingsCopyWithImpl(this as AppSettings, _$identity); /// Serializes this AppSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettings&&(identical(other.themeSettings, themeSettings) || other.themeSettings == themeSettings)&&(identical(other.playerSettings, playerSettings) || other.playerSettings == playerSettings)&&(identical(other.sleepTimerSettings, sleepTimerSettings) || other.sleepTimerSettings == sleepTimerSettings)&&(identical(other.downloadSettings, downloadSettings) || other.downloadSettings == downloadSettings)&&(identical(other.notificationSettings, notificationSettings) || other.notificationSettings == notificationSettings)&&(identical(other.shakeDetectionSettings, shakeDetectionSettings) || other.shakeDetectionSettings == shakeDetectionSettings)&&(identical(other.homePageSettings, homePageSettings) || other.homePageSettings == homePageSettings)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,themeSettings,playerSettings,sleepTimerSettings,downloadSettings,notificationSettings,shakeDetectionSettings,homePageSettings); + +@override +String toString() { + return 'AppSettings(themeSettings: $themeSettings, playerSettings: $playerSettings, sleepTimerSettings: $sleepTimerSettings, downloadSettings: $downloadSettings, notificationSettings: $notificationSettings, shakeDetectionSettings: $shakeDetectionSettings, homePageSettings: $homePageSettings)'; +} + - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $AppSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $AppSettingsCopyWith<$Res> { - factory $AppSettingsCopyWith( - AppSettings value, $Res Function(AppSettings) then) = - _$AppSettingsCopyWithImpl<$Res, AppSettings>; - @useResult - $Res call( - {ThemeSettings themeSettings, - PlayerSettings playerSettings, - SleepTimerSettings sleepTimerSettings, - DownloadSettings downloadSettings, - NotificationSettings notificationSettings, - ShakeDetectionSettings shakeDetectionSettings, - HomePageSettings homePageSettings}); +abstract mixin class $AppSettingsCopyWith<$Res> { + factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl; +@useResult +$Res call({ + ThemeSettings themeSettings, PlayerSettings playerSettings, SleepTimerSettings sleepTimerSettings, DownloadSettings downloadSettings, NotificationSettings notificationSettings, ShakeDetectionSettings shakeDetectionSettings, HomePageSettings homePageSettings +}); + + +$ThemeSettingsCopyWith<$Res> get themeSettings;$PlayerSettingsCopyWith<$Res> get playerSettings;$SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings;$DownloadSettingsCopyWith<$Res> get downloadSettings;$NotificationSettingsCopyWith<$Res> get notificationSettings;$ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings;$HomePageSettingsCopyWith<$Res> get homePageSettings; - $ThemeSettingsCopyWith<$Res> get themeSettings; - $PlayerSettingsCopyWith<$Res> get playerSettings; - $SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings; - $DownloadSettingsCopyWith<$Res> get downloadSettings; - $NotificationSettingsCopyWith<$Res> get notificationSettings; - $ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings; - $HomePageSettingsCopyWith<$Res> get homePageSettings; } - /// @nodoc -class _$AppSettingsCopyWithImpl<$Res, $Val extends AppSettings> +class _$AppSettingsCopyWithImpl<$Res> implements $AppSettingsCopyWith<$Res> { - _$AppSettingsCopyWithImpl(this._value, this._then); + _$AppSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final AppSettings _self; + final $Res Function(AppSettings) _then; - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? themeSettings = null, - Object? playerSettings = null, - Object? sleepTimerSettings = null, - Object? downloadSettings = null, - Object? notificationSettings = null, - Object? shakeDetectionSettings = null, - Object? homePageSettings = null, - }) { - return _then(_value.copyWith( - themeSettings: null == themeSettings - ? _value.themeSettings - : themeSettings // ignore: cast_nullable_to_non_nullable - as ThemeSettings, - playerSettings: null == playerSettings - ? _value.playerSettings - : playerSettings // ignore: cast_nullable_to_non_nullable - as PlayerSettings, - sleepTimerSettings: null == sleepTimerSettings - ? _value.sleepTimerSettings - : sleepTimerSettings // ignore: cast_nullable_to_non_nullable - as SleepTimerSettings, - downloadSettings: null == downloadSettings - ? _value.downloadSettings - : downloadSettings // ignore: cast_nullable_to_non_nullable - as DownloadSettings, - notificationSettings: null == notificationSettings - ? _value.notificationSettings - : notificationSettings // ignore: cast_nullable_to_non_nullable - as NotificationSettings, - shakeDetectionSettings: null == shakeDetectionSettings - ? _value.shakeDetectionSettings - : shakeDetectionSettings // ignore: cast_nullable_to_non_nullable - as ShakeDetectionSettings, - homePageSettings: null == homePageSettings - ? _value.homePageSettings - : homePageSettings // ignore: cast_nullable_to_non_nullable - as HomePageSettings, - ) as $Val); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ThemeSettingsCopyWith<$Res> get themeSettings { - return $ThemeSettingsCopyWith<$Res>(_value.themeSettings, (value) { - return _then(_value.copyWith(themeSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PlayerSettingsCopyWith<$Res> get playerSettings { - return $PlayerSettingsCopyWith<$Res>(_value.playerSettings, (value) { - return _then(_value.copyWith(playerSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings { - return $SleepTimerSettingsCopyWith<$Res>(_value.sleepTimerSettings, - (value) { - return _then(_value.copyWith(sleepTimerSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $DownloadSettingsCopyWith<$Res> get downloadSettings { - return $DownloadSettingsCopyWith<$Res>(_value.downloadSettings, (value) { - return _then(_value.copyWith(downloadSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $NotificationSettingsCopyWith<$Res> get notificationSettings { - return $NotificationSettingsCopyWith<$Res>(_value.notificationSettings, - (value) { - return _then(_value.copyWith(notificationSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings { - return $ShakeDetectionSettingsCopyWith<$Res>(_value.shakeDetectionSettings, - (value) { - return _then(_value.copyWith(shakeDetectionSettings: value) as $Val); - }); - } - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $HomePageSettingsCopyWith<$Res> get homePageSettings { - return $HomePageSettingsCopyWith<$Res>(_value.homePageSettings, (value) { - return _then(_value.copyWith(homePageSettings: value) as $Val); - }); - } +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? themeSettings = null,Object? playerSettings = null,Object? sleepTimerSettings = null,Object? downloadSettings = null,Object? notificationSettings = null,Object? shakeDetectionSettings = null,Object? homePageSettings = null,}) { + return _then(_self.copyWith( +themeSettings: null == themeSettings ? _self.themeSettings : themeSettings // ignore: cast_nullable_to_non_nullable +as ThemeSettings,playerSettings: null == playerSettings ? _self.playerSettings : playerSettings // ignore: cast_nullable_to_non_nullable +as PlayerSettings,sleepTimerSettings: null == sleepTimerSettings ? _self.sleepTimerSettings : sleepTimerSettings // ignore: cast_nullable_to_non_nullable +as SleepTimerSettings,downloadSettings: null == downloadSettings ? _self.downloadSettings : downloadSettings // ignore: cast_nullable_to_non_nullable +as DownloadSettings,notificationSettings: null == notificationSettings ? _self.notificationSettings : notificationSettings // ignore: cast_nullable_to_non_nullable +as NotificationSettings,shakeDetectionSettings: null == shakeDetectionSettings ? _self.shakeDetectionSettings : shakeDetectionSettings // ignore: cast_nullable_to_non_nullable +as ShakeDetectionSettings,homePageSettings: null == homePageSettings ? _self.homePageSettings : homePageSettings // ignore: cast_nullable_to_non_nullable +as HomePageSettings, + )); +} +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ThemeSettingsCopyWith<$Res> get themeSettings { + + return $ThemeSettingsCopyWith<$Res>(_self.themeSettings, (value) { + return _then(_self.copyWith(themeSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PlayerSettingsCopyWith<$Res> get playerSettings { + + return $PlayerSettingsCopyWith<$Res>(_self.playerSettings, (value) { + return _then(_self.copyWith(playerSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings { + + return $SleepTimerSettingsCopyWith<$Res>(_self.sleepTimerSettings, (value) { + return _then(_self.copyWith(sleepTimerSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DownloadSettingsCopyWith<$Res> get downloadSettings { + + return $DownloadSettingsCopyWith<$Res>(_self.downloadSettings, (value) { + return _then(_self.copyWith(downloadSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$NotificationSettingsCopyWith<$Res> get notificationSettings { + + return $NotificationSettingsCopyWith<$Res>(_self.notificationSettings, (value) { + return _then(_self.copyWith(notificationSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings { + + return $ShakeDetectionSettingsCopyWith<$Res>(_self.shakeDetectionSettings, (value) { + return _then(_self.copyWith(shakeDetectionSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$HomePageSettingsCopyWith<$Res> get homePageSettings { + + return $HomePageSettingsCopyWith<$Res>(_self.homePageSettings, (value) { + return _then(_self.copyWith(homePageSettings: value)); + }); +} } -/// @nodoc -abstract class _$$AppSettingsImplCopyWith<$Res> - implements $AppSettingsCopyWith<$Res> { - factory _$$AppSettingsImplCopyWith( - _$AppSettingsImpl value, $Res Function(_$AppSettingsImpl) then) = - __$$AppSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {ThemeSettings themeSettings, - PlayerSettings playerSettings, - SleepTimerSettings sleepTimerSettings, - DownloadSettings downloadSettings, - NotificationSettings notificationSettings, - ShakeDetectionSettings shakeDetectionSettings, - HomePageSettings homePageSettings}); - @override - $ThemeSettingsCopyWith<$Res> get themeSettings; - @override - $PlayerSettingsCopyWith<$Res> get playerSettings; - @override - $SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings; - @override - $DownloadSettingsCopyWith<$Res> get downloadSettings; - @override - $NotificationSettingsCopyWith<$Res> get notificationSettings; - @override - $ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings; - @override - $HomePageSettingsCopyWith<$Res> get homePageSettings; +/// Adds pattern-matching-related methods to [AppSettings]. +extension AppSettingsPatterns on AppSettings { +/// 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 Function( _AppSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AppSettings() 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 Function( _AppSettings value) $default,){ +final _that = this; +switch (_that) { +case _AppSettings(): +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? Function( _AppSettings value)? $default,){ +final _that = this; +switch (_that) { +case _AppSettings() 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 Function( ThemeSettings themeSettings, PlayerSettings playerSettings, SleepTimerSettings sleepTimerSettings, DownloadSettings downloadSettings, NotificationSettings notificationSettings, ShakeDetectionSettings shakeDetectionSettings, HomePageSettings homePageSettings)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AppSettings() when $default != null: +return $default(_that.themeSettings,_that.playerSettings,_that.sleepTimerSettings,_that.downloadSettings,_that.notificationSettings,_that.shakeDetectionSettings,_that.homePageSettings);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 Function( ThemeSettings themeSettings, PlayerSettings playerSettings, SleepTimerSettings sleepTimerSettings, DownloadSettings downloadSettings, NotificationSettings notificationSettings, ShakeDetectionSettings shakeDetectionSettings, HomePageSettings homePageSettings) $default,) {final _that = this; +switch (_that) { +case _AppSettings(): +return $default(_that.themeSettings,_that.playerSettings,_that.sleepTimerSettings,_that.downloadSettings,_that.notificationSettings,_that.shakeDetectionSettings,_that.homePageSettings);} +} +/// 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? Function( ThemeSettings themeSettings, PlayerSettings playerSettings, SleepTimerSettings sleepTimerSettings, DownloadSettings downloadSettings, NotificationSettings notificationSettings, ShakeDetectionSettings shakeDetectionSettings, HomePageSettings homePageSettings)? $default,) {final _that = this; +switch (_that) { +case _AppSettings() when $default != null: +return $default(_that.themeSettings,_that.playerSettings,_that.sleepTimerSettings,_that.downloadSettings,_that.notificationSettings,_that.shakeDetectionSettings,_that.homePageSettings);case _: + return null; + +} } -/// @nodoc -class __$$AppSettingsImplCopyWithImpl<$Res> - extends _$AppSettingsCopyWithImpl<$Res, _$AppSettingsImpl> - implements _$$AppSettingsImplCopyWith<$Res> { - __$$AppSettingsImplCopyWithImpl( - _$AppSettingsImpl _value, $Res Function(_$AppSettingsImpl) _then) - : super(_value, _then); - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? themeSettings = null, - Object? playerSettings = null, - Object? sleepTimerSettings = null, - Object? downloadSettings = null, - Object? notificationSettings = null, - Object? shakeDetectionSettings = null, - Object? homePageSettings = null, - }) { - return _then(_$AppSettingsImpl( - themeSettings: null == themeSettings - ? _value.themeSettings - : themeSettings // ignore: cast_nullable_to_non_nullable - as ThemeSettings, - playerSettings: null == playerSettings - ? _value.playerSettings - : playerSettings // ignore: cast_nullable_to_non_nullable - as PlayerSettings, - sleepTimerSettings: null == sleepTimerSettings - ? _value.sleepTimerSettings - : sleepTimerSettings // ignore: cast_nullable_to_non_nullable - as SleepTimerSettings, - downloadSettings: null == downloadSettings - ? _value.downloadSettings - : downloadSettings // ignore: cast_nullable_to_non_nullable - as DownloadSettings, - notificationSettings: null == notificationSettings - ? _value.notificationSettings - : notificationSettings // ignore: cast_nullable_to_non_nullable - as NotificationSettings, - shakeDetectionSettings: null == shakeDetectionSettings - ? _value.shakeDetectionSettings - : shakeDetectionSettings // ignore: cast_nullable_to_non_nullable - as ShakeDetectionSettings, - homePageSettings: null == homePageSettings - ? _value.homePageSettings - : homePageSettings // ignore: cast_nullable_to_non_nullable - as HomePageSettings, - )); - } } /// @nodoc @JsonSerializable() -class _$AppSettingsImpl implements _AppSettings { - const _$AppSettingsImpl( - {this.themeSettings = const ThemeSettings(), - this.playerSettings = const PlayerSettings(), - this.sleepTimerSettings = const SleepTimerSettings(), - this.downloadSettings = const DownloadSettings(), - this.notificationSettings = const NotificationSettings(), - this.shakeDetectionSettings = const ShakeDetectionSettings(), - this.homePageSettings = const HomePageSettings()}); - factory _$AppSettingsImpl.fromJson(Map json) => - _$$AppSettingsImplFromJson(json); +class _AppSettings implements AppSettings { + const _AppSettings({this.themeSettings = const ThemeSettings(), this.playerSettings = const PlayerSettings(), this.sleepTimerSettings = const SleepTimerSettings(), this.downloadSettings = const DownloadSettings(), this.notificationSettings = const NotificationSettings(), this.shakeDetectionSettings = const ShakeDetectionSettings(), this.homePageSettings = const HomePageSettings()}); + factory _AppSettings.fromJson(Map json) => _$AppSettingsFromJson(json); - @override - @JsonKey() - final ThemeSettings themeSettings; - @override - @JsonKey() - final PlayerSettings playerSettings; - @override - @JsonKey() - final SleepTimerSettings sleepTimerSettings; - @override - @JsonKey() - final DownloadSettings downloadSettings; - @override - @JsonKey() - final NotificationSettings notificationSettings; - @override - @JsonKey() - final ShakeDetectionSettings shakeDetectionSettings; - @override - @JsonKey() - final HomePageSettings homePageSettings; +@override@JsonKey() final ThemeSettings themeSettings; +@override@JsonKey() final PlayerSettings playerSettings; +@override@JsonKey() final SleepTimerSettings sleepTimerSettings; +@override@JsonKey() final DownloadSettings downloadSettings; +@override@JsonKey() final NotificationSettings notificationSettings; +@override@JsonKey() final ShakeDetectionSettings shakeDetectionSettings; +@override@JsonKey() final HomePageSettings homePageSettings; - @override - String toString() { - return 'AppSettings(themeSettings: $themeSettings, playerSettings: $playerSettings, sleepTimerSettings: $sleepTimerSettings, downloadSettings: $downloadSettings, notificationSettings: $notificationSettings, shakeDetectionSettings: $shakeDetectionSettings, homePageSettings: $homePageSettings)'; - } +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_AppSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$AppSettingsImpl && - (identical(other.themeSettings, themeSettings) || - other.themeSettings == themeSettings) && - (identical(other.playerSettings, playerSettings) || - other.playerSettings == playerSettings) && - (identical(other.sleepTimerSettings, sleepTimerSettings) || - other.sleepTimerSettings == sleepTimerSettings) && - (identical(other.downloadSettings, downloadSettings) || - other.downloadSettings == downloadSettings) && - (identical(other.notificationSettings, notificationSettings) || - other.notificationSettings == notificationSettings) && - (identical(other.shakeDetectionSettings, shakeDetectionSettings) || - other.shakeDetectionSettings == shakeDetectionSettings) && - (identical(other.homePageSettings, homePageSettings) || - other.homePageSettings == homePageSettings)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - themeSettings, - playerSettings, - sleepTimerSettings, - downloadSettings, - notificationSettings, - shakeDetectionSettings, - homePageSettings); - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$AppSettingsImplCopyWith<_$AppSettingsImpl> get copyWith => - __$$AppSettingsImplCopyWithImpl<_$AppSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$AppSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$AppSettingsToJson(this, ); } -abstract class _AppSettings implements AppSettings { - const factory _AppSettings( - {final ThemeSettings themeSettings, - final PlayerSettings playerSettings, - final SleepTimerSettings sleepTimerSettings, - final DownloadSettings downloadSettings, - final NotificationSettings notificationSettings, - final ShakeDetectionSettings shakeDetectionSettings, - final HomePageSettings homePageSettings}) = _$AppSettingsImpl; - - factory _AppSettings.fromJson(Map json) = - _$AppSettingsImpl.fromJson; - - @override - ThemeSettings get themeSettings; - @override - PlayerSettings get playerSettings; - @override - SleepTimerSettings get sleepTimerSettings; - @override - DownloadSettings get downloadSettings; - @override - NotificationSettings get notificationSettings; - @override - ShakeDetectionSettings get shakeDetectionSettings; - @override - HomePageSettings get homePageSettings; - - /// Create a copy of AppSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$AppSettingsImplCopyWith<_$AppSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.themeSettings, themeSettings) || other.themeSettings == themeSettings)&&(identical(other.playerSettings, playerSettings) || other.playerSettings == playerSettings)&&(identical(other.sleepTimerSettings, sleepTimerSettings) || other.sleepTimerSettings == sleepTimerSettings)&&(identical(other.downloadSettings, downloadSettings) || other.downloadSettings == downloadSettings)&&(identical(other.notificationSettings, notificationSettings) || other.notificationSettings == notificationSettings)&&(identical(other.shakeDetectionSettings, shakeDetectionSettings) || other.shakeDetectionSettings == shakeDetectionSettings)&&(identical(other.homePageSettings, homePageSettings) || other.homePageSettings == homePageSettings)); } -ThemeSettings _$ThemeSettingsFromJson(Map json) { - return _ThemeSettings.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,themeSettings,playerSettings,sleepTimerSettings,downloadSettings,notificationSettings,shakeDetectionSettings,homePageSettings); + +@override +String toString() { + return 'AppSettings(themeSettings: $themeSettings, playerSettings: $playerSettings, sleepTimerSettings: $sleepTimerSettings, downloadSettings: $downloadSettings, notificationSettings: $notificationSettings, shakeDetectionSettings: $shakeDetectionSettings, homePageSettings: $homePageSettings)'; } + +} + +/// @nodoc +abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith<$Res> { + factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl; +@override @useResult +$Res call({ + ThemeSettings themeSettings, PlayerSettings playerSettings, SleepTimerSettings sleepTimerSettings, DownloadSettings downloadSettings, NotificationSettings notificationSettings, ShakeDetectionSettings shakeDetectionSettings, HomePageSettings homePageSettings +}); + + +@override $ThemeSettingsCopyWith<$Res> get themeSettings;@override $PlayerSettingsCopyWith<$Res> get playerSettings;@override $SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings;@override $DownloadSettingsCopyWith<$Res> get downloadSettings;@override $NotificationSettingsCopyWith<$Res> get notificationSettings;@override $ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings;@override $HomePageSettingsCopyWith<$Res> get homePageSettings; + +} +/// @nodoc +class __$AppSettingsCopyWithImpl<$Res> + implements _$AppSettingsCopyWith<$Res> { + __$AppSettingsCopyWithImpl(this._self, this._then); + + final _AppSettings _self; + final $Res Function(_AppSettings) _then; + +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? themeSettings = null,Object? playerSettings = null,Object? sleepTimerSettings = null,Object? downloadSettings = null,Object? notificationSettings = null,Object? shakeDetectionSettings = null,Object? homePageSettings = null,}) { + return _then(_AppSettings( +themeSettings: null == themeSettings ? _self.themeSettings : themeSettings // ignore: cast_nullable_to_non_nullable +as ThemeSettings,playerSettings: null == playerSettings ? _self.playerSettings : playerSettings // ignore: cast_nullable_to_non_nullable +as PlayerSettings,sleepTimerSettings: null == sleepTimerSettings ? _self.sleepTimerSettings : sleepTimerSettings // ignore: cast_nullable_to_non_nullable +as SleepTimerSettings,downloadSettings: null == downloadSettings ? _self.downloadSettings : downloadSettings // ignore: cast_nullable_to_non_nullable +as DownloadSettings,notificationSettings: null == notificationSettings ? _self.notificationSettings : notificationSettings // ignore: cast_nullable_to_non_nullable +as NotificationSettings,shakeDetectionSettings: null == shakeDetectionSettings ? _self.shakeDetectionSettings : shakeDetectionSettings // ignore: cast_nullable_to_non_nullable +as ShakeDetectionSettings,homePageSettings: null == homePageSettings ? _self.homePageSettings : homePageSettings // ignore: cast_nullable_to_non_nullable +as HomePageSettings, + )); +} + +/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ThemeSettingsCopyWith<$Res> get themeSettings { + + return $ThemeSettingsCopyWith<$Res>(_self.themeSettings, (value) { + return _then(_self.copyWith(themeSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PlayerSettingsCopyWith<$Res> get playerSettings { + + return $PlayerSettingsCopyWith<$Res>(_self.playerSettings, (value) { + return _then(_self.copyWith(playerSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SleepTimerSettingsCopyWith<$Res> get sleepTimerSettings { + + return $SleepTimerSettingsCopyWith<$Res>(_self.sleepTimerSettings, (value) { + return _then(_self.copyWith(sleepTimerSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DownloadSettingsCopyWith<$Res> get downloadSettings { + + return $DownloadSettingsCopyWith<$Res>(_self.downloadSettings, (value) { + return _then(_self.copyWith(downloadSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$NotificationSettingsCopyWith<$Res> get notificationSettings { + + return $NotificationSettingsCopyWith<$Res>(_self.notificationSettings, (value) { + return _then(_self.copyWith(notificationSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ShakeDetectionSettingsCopyWith<$Res> get shakeDetectionSettings { + + return $ShakeDetectionSettingsCopyWith<$Res>(_self.shakeDetectionSettings, (value) { + return _then(_self.copyWith(shakeDetectionSettings: value)); + }); +}/// Create a copy of AppSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$HomePageSettingsCopyWith<$Res> get homePageSettings { + + return $HomePageSettingsCopyWith<$Res>(_self.homePageSettings, (value) { + return _then(_self.copyWith(homePageSettings: value)); + }); +} +} + + /// @nodoc mixin _$ThemeSettings { - ThemeMode get themeMode => throw _privateConstructorUsedError; - bool get highContrast => throw _privateConstructorUsedError; - bool get useMaterialThemeFromSystem => throw _privateConstructorUsedError; - String get customThemeColor => throw _privateConstructorUsedError; - bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError; - bool get useCurrentPlayerThemeThroughoutApp => - throw _privateConstructorUsedError; + + ThemeMode get themeMode; bool get highContrast; bool get useMaterialThemeFromSystem; String get customThemeColor; bool get useMaterialThemeOnItemPage; bool get useCurrentPlayerThemeThroughoutApp; +/// Create a copy of ThemeSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ThemeSettingsCopyWith get copyWith => _$ThemeSettingsCopyWithImpl(this as ThemeSettings, _$identity); /// Serializes this ThemeSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ThemeSettings&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.highContrast, highContrast) || other.highContrast == highContrast)&&(identical(other.useMaterialThemeFromSystem, useMaterialThemeFromSystem) || other.useMaterialThemeFromSystem == useMaterialThemeFromSystem)&&(identical(other.customThemeColor, customThemeColor) || other.customThemeColor == customThemeColor)&&(identical(other.useMaterialThemeOnItemPage, useMaterialThemeOnItemPage) || other.useMaterialThemeOnItemPage == useMaterialThemeOnItemPage)&&(identical(other.useCurrentPlayerThemeThroughoutApp, useCurrentPlayerThemeThroughoutApp) || other.useCurrentPlayerThemeThroughoutApp == useCurrentPlayerThemeThroughoutApp)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,themeMode,highContrast,useMaterialThemeFromSystem,customThemeColor,useMaterialThemeOnItemPage,useCurrentPlayerThemeThroughoutApp); + +@override +String toString() { + return 'ThemeSettings(themeMode: $themeMode, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)'; +} + - /// Create a copy of ThemeSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ThemeSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $ThemeSettingsCopyWith<$Res> { - factory $ThemeSettingsCopyWith( - ThemeSettings value, $Res Function(ThemeSettings) then) = - _$ThemeSettingsCopyWithImpl<$Res, ThemeSettings>; - @useResult - $Res call( - {ThemeMode themeMode, - bool highContrast, - bool useMaterialThemeFromSystem, - String customThemeColor, - bool useMaterialThemeOnItemPage, - bool useCurrentPlayerThemeThroughoutApp}); -} +abstract mixin class $ThemeSettingsCopyWith<$Res> { + factory $ThemeSettingsCopyWith(ThemeSettings value, $Res Function(ThemeSettings) _then) = _$ThemeSettingsCopyWithImpl; +@useResult +$Res call({ + ThemeMode themeMode, bool highContrast, bool useMaterialThemeFromSystem, String customThemeColor, bool useMaterialThemeOnItemPage, bool useCurrentPlayerThemeThroughoutApp +}); + + + +} /// @nodoc -class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings> +class _$ThemeSettingsCopyWithImpl<$Res> implements $ThemeSettingsCopyWith<$Res> { - _$ThemeSettingsCopyWithImpl(this._value, this._then); + _$ThemeSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final ThemeSettings _self; + final $Res Function(ThemeSettings) _then; - /// Create a copy of ThemeSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? themeMode = null, - Object? highContrast = null, - Object? useMaterialThemeFromSystem = null, - Object? customThemeColor = null, - Object? useMaterialThemeOnItemPage = null, - Object? useCurrentPlayerThemeThroughoutApp = null, - }) { - return _then(_value.copyWith( - themeMode: null == themeMode - ? _value.themeMode - : themeMode // ignore: cast_nullable_to_non_nullable - as ThemeMode, - highContrast: null == highContrast - ? _value.highContrast - : highContrast // ignore: cast_nullable_to_non_nullable - as bool, - useMaterialThemeFromSystem: null == useMaterialThemeFromSystem - ? _value.useMaterialThemeFromSystem - : useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable - as bool, - customThemeColor: null == customThemeColor - ? _value.customThemeColor - : customThemeColor // ignore: cast_nullable_to_non_nullable - as String, - useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage - ? _value.useMaterialThemeOnItemPage - : useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable - as bool, - useCurrentPlayerThemeThroughoutApp: null == - useCurrentPlayerThemeThroughoutApp - ? _value.useCurrentPlayerThemeThroughoutApp - : useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } +/// Create a copy of ThemeSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? themeMode = null,Object? highContrast = null,Object? useMaterialThemeFromSystem = null,Object? customThemeColor = null,Object? useMaterialThemeOnItemPage = null,Object? useCurrentPlayerThemeThroughoutApp = null,}) { + return _then(_self.copyWith( +themeMode: null == themeMode ? _self.themeMode : themeMode // ignore: cast_nullable_to_non_nullable +as ThemeMode,highContrast: null == highContrast ? _self.highContrast : highContrast // ignore: cast_nullable_to_non_nullable +as bool,useMaterialThemeFromSystem: null == useMaterialThemeFromSystem ? _self.useMaterialThemeFromSystem : useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable +as bool,customThemeColor: null == customThemeColor ? _self.customThemeColor : customThemeColor // ignore: cast_nullable_to_non_nullable +as String,useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage ? _self.useMaterialThemeOnItemPage : useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable +as bool,useCurrentPlayerThemeThroughoutApp: null == useCurrentPlayerThemeThroughoutApp ? _self.useCurrentPlayerThemeThroughoutApp : useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable +as bool, + )); } -/// @nodoc -abstract class _$$ThemeSettingsImplCopyWith<$Res> - implements $ThemeSettingsCopyWith<$Res> { - factory _$$ThemeSettingsImplCopyWith( - _$ThemeSettingsImpl value, $Res Function(_$ThemeSettingsImpl) then) = - __$$ThemeSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {ThemeMode themeMode, - bool highContrast, - bool useMaterialThemeFromSystem, - String customThemeColor, - bool useMaterialThemeOnItemPage, - bool useCurrentPlayerThemeThroughoutApp}); } -/// @nodoc -class __$$ThemeSettingsImplCopyWithImpl<$Res> - extends _$ThemeSettingsCopyWithImpl<$Res, _$ThemeSettingsImpl> - implements _$$ThemeSettingsImplCopyWith<$Res> { - __$$ThemeSettingsImplCopyWithImpl( - _$ThemeSettingsImpl _value, $Res Function(_$ThemeSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of ThemeSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? themeMode = null, - Object? highContrast = null, - Object? useMaterialThemeFromSystem = null, - Object? customThemeColor = null, - Object? useMaterialThemeOnItemPage = null, - Object? useCurrentPlayerThemeThroughoutApp = null, - }) { - return _then(_$ThemeSettingsImpl( - themeMode: null == themeMode - ? _value.themeMode - : themeMode // ignore: cast_nullable_to_non_nullable - as ThemeMode, - highContrast: null == highContrast - ? _value.highContrast - : highContrast // ignore: cast_nullable_to_non_nullable - as bool, - useMaterialThemeFromSystem: null == useMaterialThemeFromSystem - ? _value.useMaterialThemeFromSystem - : useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable - as bool, - customThemeColor: null == customThemeColor - ? _value.customThemeColor - : customThemeColor // ignore: cast_nullable_to_non_nullable - as String, - useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage - ? _value.useMaterialThemeOnItemPage - : useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable - as bool, - useCurrentPlayerThemeThroughoutApp: null == - useCurrentPlayerThemeThroughoutApp - ? _value.useCurrentPlayerThemeThroughoutApp - : useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable - as bool, - )); - } +/// Adds pattern-matching-related methods to [ThemeSettings]. +extension ThemeSettingsPatterns on ThemeSettings { +/// 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 Function( _ThemeSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ThemeSettings() 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 Function( _ThemeSettings value) $default,){ +final _that = this; +switch (_that) { +case _ThemeSettings(): +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? Function( _ThemeSettings value)? $default,){ +final _that = this; +switch (_that) { +case _ThemeSettings() 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 Function( ThemeMode themeMode, bool highContrast, bool useMaterialThemeFromSystem, String customThemeColor, bool useMaterialThemeOnItemPage, bool useCurrentPlayerThemeThroughoutApp)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ThemeSettings() when $default != null: +return $default(_that.themeMode,_that.highContrast,_that.useMaterialThemeFromSystem,_that.customThemeColor,_that.useMaterialThemeOnItemPage,_that.useCurrentPlayerThemeThroughoutApp);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 Function( ThemeMode themeMode, bool highContrast, bool useMaterialThemeFromSystem, String customThemeColor, bool useMaterialThemeOnItemPage, bool useCurrentPlayerThemeThroughoutApp) $default,) {final _that = this; +switch (_that) { +case _ThemeSettings(): +return $default(_that.themeMode,_that.highContrast,_that.useMaterialThemeFromSystem,_that.customThemeColor,_that.useMaterialThemeOnItemPage,_that.useCurrentPlayerThemeThroughoutApp);} +} +/// 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? Function( ThemeMode themeMode, bool highContrast, bool useMaterialThemeFromSystem, String customThemeColor, bool useMaterialThemeOnItemPage, bool useCurrentPlayerThemeThroughoutApp)? $default,) {final _that = this; +switch (_that) { +case _ThemeSettings() when $default != null: +return $default(_that.themeMode,_that.highContrast,_that.useMaterialThemeFromSystem,_that.customThemeColor,_that.useMaterialThemeOnItemPage,_that.useCurrentPlayerThemeThroughoutApp);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$ThemeSettingsImpl implements _ThemeSettings { - const _$ThemeSettingsImpl( - {this.themeMode = ThemeMode.system, - this.highContrast = false, - this.useMaterialThemeFromSystem = false, - this.customThemeColor = '#FF311B92', - this.useMaterialThemeOnItemPage = true, - this.useCurrentPlayerThemeThroughoutApp = true}); - factory _$ThemeSettingsImpl.fromJson(Map json) => - _$$ThemeSettingsImplFromJson(json); +class _ThemeSettings implements ThemeSettings { + const _ThemeSettings({this.themeMode = ThemeMode.system, this.highContrast = false, this.useMaterialThemeFromSystem = false, this.customThemeColor = '#FF311B92', this.useMaterialThemeOnItemPage = true, this.useCurrentPlayerThemeThroughoutApp = true}); + factory _ThemeSettings.fromJson(Map json) => _$ThemeSettingsFromJson(json); - @override - @JsonKey() - final ThemeMode themeMode; - @override - @JsonKey() - final bool highContrast; - @override - @JsonKey() - final bool useMaterialThemeFromSystem; - @override - @JsonKey() - final String customThemeColor; - @override - @JsonKey() - final bool useMaterialThemeOnItemPage; - @override - @JsonKey() - final bool useCurrentPlayerThemeThroughoutApp; +@override@JsonKey() final ThemeMode themeMode; +@override@JsonKey() final bool highContrast; +@override@JsonKey() final bool useMaterialThemeFromSystem; +@override@JsonKey() final String customThemeColor; +@override@JsonKey() final bool useMaterialThemeOnItemPage; +@override@JsonKey() final bool useCurrentPlayerThemeThroughoutApp; - @override - String toString() { - return 'ThemeSettings(themeMode: $themeMode, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)'; - } +/// Create a copy of ThemeSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ThemeSettingsCopyWith<_ThemeSettings> get copyWith => __$ThemeSettingsCopyWithImpl<_ThemeSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ThemeSettingsImpl && - (identical(other.themeMode, themeMode) || - other.themeMode == themeMode) && - (identical(other.highContrast, highContrast) || - other.highContrast == highContrast) && - (identical(other.useMaterialThemeFromSystem, - useMaterialThemeFromSystem) || - other.useMaterialThemeFromSystem == - useMaterialThemeFromSystem) && - (identical(other.customThemeColor, customThemeColor) || - other.customThemeColor == customThemeColor) && - (identical(other.useMaterialThemeOnItemPage, - useMaterialThemeOnItemPage) || - other.useMaterialThemeOnItemPage == - useMaterialThemeOnItemPage) && - (identical(other.useCurrentPlayerThemeThroughoutApp, - useCurrentPlayerThemeThroughoutApp) || - other.useCurrentPlayerThemeThroughoutApp == - useCurrentPlayerThemeThroughoutApp)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - themeMode, - highContrast, - useMaterialThemeFromSystem, - customThemeColor, - useMaterialThemeOnItemPage, - useCurrentPlayerThemeThroughoutApp); - - /// Create a copy of ThemeSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith => - __$$ThemeSettingsImplCopyWithImpl<_$ThemeSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ThemeSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$ThemeSettingsToJson(this, ); } -abstract class _ThemeSettings implements ThemeSettings { - const factory _ThemeSettings( - {final ThemeMode themeMode, - final bool highContrast, - final bool useMaterialThemeFromSystem, - final String customThemeColor, - final bool useMaterialThemeOnItemPage, - final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl; - - factory _ThemeSettings.fromJson(Map json) = - _$ThemeSettingsImpl.fromJson; - - @override - ThemeMode get themeMode; - @override - bool get highContrast; - @override - bool get useMaterialThemeFromSystem; - @override - String get customThemeColor; - @override - bool get useMaterialThemeOnItemPage; - @override - bool get useCurrentPlayerThemeThroughoutApp; - - /// Create a copy of ThemeSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ThemeSettings&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.highContrast, highContrast) || other.highContrast == highContrast)&&(identical(other.useMaterialThemeFromSystem, useMaterialThemeFromSystem) || other.useMaterialThemeFromSystem == useMaterialThemeFromSystem)&&(identical(other.customThemeColor, customThemeColor) || other.customThemeColor == customThemeColor)&&(identical(other.useMaterialThemeOnItemPage, useMaterialThemeOnItemPage) || other.useMaterialThemeOnItemPage == useMaterialThemeOnItemPage)&&(identical(other.useCurrentPlayerThemeThroughoutApp, useCurrentPlayerThemeThroughoutApp) || other.useCurrentPlayerThemeThroughoutApp == useCurrentPlayerThemeThroughoutApp)); } -PlayerSettings _$PlayerSettingsFromJson(Map json) { - return _PlayerSettings.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,themeMode,highContrast,useMaterialThemeFromSystem,customThemeColor,useMaterialThemeOnItemPage,useCurrentPlayerThemeThroughoutApp); + +@override +String toString() { + return 'ThemeSettings(themeMode: $themeMode, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)'; } + +} + +/// @nodoc +abstract mixin class _$ThemeSettingsCopyWith<$Res> implements $ThemeSettingsCopyWith<$Res> { + factory _$ThemeSettingsCopyWith(_ThemeSettings value, $Res Function(_ThemeSettings) _then) = __$ThemeSettingsCopyWithImpl; +@override @useResult +$Res call({ + ThemeMode themeMode, bool highContrast, bool useMaterialThemeFromSystem, String customThemeColor, bool useMaterialThemeOnItemPage, bool useCurrentPlayerThemeThroughoutApp +}); + + + + +} +/// @nodoc +class __$ThemeSettingsCopyWithImpl<$Res> + implements _$ThemeSettingsCopyWith<$Res> { + __$ThemeSettingsCopyWithImpl(this._self, this._then); + + final _ThemeSettings _self; + final $Res Function(_ThemeSettings) _then; + +/// Create a copy of ThemeSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? themeMode = null,Object? highContrast = null,Object? useMaterialThemeFromSystem = null,Object? customThemeColor = null,Object? useMaterialThemeOnItemPage = null,Object? useCurrentPlayerThemeThroughoutApp = null,}) { + return _then(_ThemeSettings( +themeMode: null == themeMode ? _self.themeMode : themeMode // ignore: cast_nullable_to_non_nullable +as ThemeMode,highContrast: null == highContrast ? _self.highContrast : highContrast // ignore: cast_nullable_to_non_nullable +as bool,useMaterialThemeFromSystem: null == useMaterialThemeFromSystem ? _self.useMaterialThemeFromSystem : useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable +as bool,customThemeColor: null == customThemeColor ? _self.customThemeColor : customThemeColor // ignore: cast_nullable_to_non_nullable +as String,useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage ? _self.useMaterialThemeOnItemPage : useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable +as bool,useCurrentPlayerThemeThroughoutApp: null == useCurrentPlayerThemeThroughoutApp ? _self.useCurrentPlayerThemeThroughoutApp : useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + /// @nodoc mixin _$PlayerSettings { - MinimizedPlayerSettings get miniPlayerSettings => - throw _privateConstructorUsedError; - ExpandedPlayerSettings get expandedPlayerSettings => - throw _privateConstructorUsedError; - double get preferredDefaultVolume => throw _privateConstructorUsedError; - double get preferredDefaultSpeed => throw _privateConstructorUsedError; - List get speedOptions => throw _privateConstructorUsedError; - double get speedIncrement => throw _privateConstructorUsedError; - double get minSpeed => throw _privateConstructorUsedError; - double get maxSpeed => throw _privateConstructorUsedError; - Duration get minimumPositionForReporting => - throw _privateConstructorUsedError; - Duration get playbackReportInterval => throw _privateConstructorUsedError; - Duration get markCompleteWhenTimeLeft => throw _privateConstructorUsedError; - bool get configurePlayerForEveryBook => throw _privateConstructorUsedError; + + MinimizedPlayerSettings get miniPlayerSettings; ExpandedPlayerSettings get expandedPlayerSettings; double get preferredDefaultVolume; double get preferredDefaultSpeed; List get speedOptions; double get speedIncrement; double get minSpeed; double get maxSpeed; Duration get minimumPositionForReporting; Duration get playbackReportInterval; Duration get markCompleteWhenTimeLeft; bool get configurePlayerForEveryBook; +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PlayerSettingsCopyWith get copyWith => _$PlayerSettingsCopyWithImpl(this as PlayerSettings, _$identity); /// Serializes this PlayerSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PlayerSettings&&(identical(other.miniPlayerSettings, miniPlayerSettings) || other.miniPlayerSettings == miniPlayerSettings)&&(identical(other.expandedPlayerSettings, expandedPlayerSettings) || other.expandedPlayerSettings == expandedPlayerSettings)&&(identical(other.preferredDefaultVolume, preferredDefaultVolume) || other.preferredDefaultVolume == preferredDefaultVolume)&&(identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || other.preferredDefaultSpeed == preferredDefaultSpeed)&&const DeepCollectionEquality().equals(other.speedOptions, speedOptions)&&(identical(other.speedIncrement, speedIncrement) || other.speedIncrement == speedIncrement)&&(identical(other.minSpeed, minSpeed) || other.minSpeed == minSpeed)&&(identical(other.maxSpeed, maxSpeed) || other.maxSpeed == maxSpeed)&&(identical(other.minimumPositionForReporting, minimumPositionForReporting) || other.minimumPositionForReporting == minimumPositionForReporting)&&(identical(other.playbackReportInterval, playbackReportInterval) || other.playbackReportInterval == playbackReportInterval)&&(identical(other.markCompleteWhenTimeLeft, markCompleteWhenTimeLeft) || other.markCompleteWhenTimeLeft == markCompleteWhenTimeLeft)&&(identical(other.configurePlayerForEveryBook, configurePlayerForEveryBook) || other.configurePlayerForEveryBook == configurePlayerForEveryBook)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,miniPlayerSettings,expandedPlayerSettings,preferredDefaultVolume,preferredDefaultSpeed,const DeepCollectionEquality().hash(speedOptions),speedIncrement,minSpeed,maxSpeed,minimumPositionForReporting,playbackReportInterval,markCompleteWhenTimeLeft,configurePlayerForEveryBook); + +@override +String toString() { + return 'PlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, speedIncrement: $speedIncrement, minSpeed: $minSpeed, maxSpeed: $maxSpeed, minimumPositionForReporting: $minimumPositionForReporting, playbackReportInterval: $playbackReportInterval, markCompleteWhenTimeLeft: $markCompleteWhenTimeLeft, configurePlayerForEveryBook: $configurePlayerForEveryBook)'; +} + - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PlayerSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $PlayerSettingsCopyWith<$Res> { - factory $PlayerSettingsCopyWith( - PlayerSettings value, $Res Function(PlayerSettings) then) = - _$PlayerSettingsCopyWithImpl<$Res, PlayerSettings>; - @useResult - $Res call( - {MinimizedPlayerSettings miniPlayerSettings, - ExpandedPlayerSettings expandedPlayerSettings, - double preferredDefaultVolume, - double preferredDefaultSpeed, - List speedOptions, - double speedIncrement, - double minSpeed, - double maxSpeed, - Duration minimumPositionForReporting, - Duration playbackReportInterval, - Duration markCompleteWhenTimeLeft, - bool configurePlayerForEveryBook}); +abstract mixin class $PlayerSettingsCopyWith<$Res> { + factory $PlayerSettingsCopyWith(PlayerSettings value, $Res Function(PlayerSettings) _then) = _$PlayerSettingsCopyWithImpl; +@useResult +$Res call({ + MinimizedPlayerSettings miniPlayerSettings, ExpandedPlayerSettings expandedPlayerSettings, double preferredDefaultVolume, double preferredDefaultSpeed, List speedOptions, double speedIncrement, double minSpeed, double maxSpeed, Duration minimumPositionForReporting, Duration playbackReportInterval, Duration markCompleteWhenTimeLeft, bool configurePlayerForEveryBook +}); + + +$MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings;$ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings; - $MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings; - $ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings; } - /// @nodoc -class _$PlayerSettingsCopyWithImpl<$Res, $Val extends PlayerSettings> +class _$PlayerSettingsCopyWithImpl<$Res> implements $PlayerSettingsCopyWith<$Res> { - _$PlayerSettingsCopyWithImpl(this._value, this._then); + _$PlayerSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final PlayerSettings _self; + final $Res Function(PlayerSettings) _then; - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? miniPlayerSettings = null, - Object? expandedPlayerSettings = null, - Object? preferredDefaultVolume = null, - Object? preferredDefaultSpeed = null, - Object? speedOptions = null, - Object? speedIncrement = null, - Object? minSpeed = null, - Object? maxSpeed = null, - Object? minimumPositionForReporting = null, - Object? playbackReportInterval = null, - Object? markCompleteWhenTimeLeft = null, - Object? configurePlayerForEveryBook = null, - }) { - return _then(_value.copyWith( - miniPlayerSettings: null == miniPlayerSettings - ? _value.miniPlayerSettings - : miniPlayerSettings // ignore: cast_nullable_to_non_nullable - as MinimizedPlayerSettings, - expandedPlayerSettings: null == expandedPlayerSettings - ? _value.expandedPlayerSettings - : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable - as ExpandedPlayerSettings, - preferredDefaultVolume: null == preferredDefaultVolume - ? _value.preferredDefaultVolume - : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable - as double, - preferredDefaultSpeed: null == preferredDefaultSpeed - ? _value.preferredDefaultSpeed - : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable - as double, - speedOptions: null == speedOptions - ? _value.speedOptions - : speedOptions // ignore: cast_nullable_to_non_nullable - as List, - speedIncrement: null == speedIncrement - ? _value.speedIncrement - : speedIncrement // ignore: cast_nullable_to_non_nullable - as double, - minSpeed: null == minSpeed - ? _value.minSpeed - : minSpeed // ignore: cast_nullable_to_non_nullable - as double, - maxSpeed: null == maxSpeed - ? _value.maxSpeed - : maxSpeed // ignore: cast_nullable_to_non_nullable - as double, - minimumPositionForReporting: null == minimumPositionForReporting - ? _value.minimumPositionForReporting - : minimumPositionForReporting // ignore: cast_nullable_to_non_nullable - as Duration, - playbackReportInterval: null == playbackReportInterval - ? _value.playbackReportInterval - : playbackReportInterval // ignore: cast_nullable_to_non_nullable - as Duration, - markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft - ? _value.markCompleteWhenTimeLeft - : markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable - as Duration, - configurePlayerForEveryBook: null == configurePlayerForEveryBook - ? _value.configurePlayerForEveryBook - : configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } - - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings { - return $MinimizedPlayerSettingsCopyWith<$Res>(_value.miniPlayerSettings, - (value) { - return _then(_value.copyWith(miniPlayerSettings: value) as $Val); - }); - } - - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings { - return $ExpandedPlayerSettingsCopyWith<$Res>(_value.expandedPlayerSettings, - (value) { - return _then(_value.copyWith(expandedPlayerSettings: value) as $Val); - }); - } +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? miniPlayerSettings = null,Object? expandedPlayerSettings = null,Object? preferredDefaultVolume = null,Object? preferredDefaultSpeed = null,Object? speedOptions = null,Object? speedIncrement = null,Object? minSpeed = null,Object? maxSpeed = null,Object? minimumPositionForReporting = null,Object? playbackReportInterval = null,Object? markCompleteWhenTimeLeft = null,Object? configurePlayerForEveryBook = null,}) { + return _then(_self.copyWith( +miniPlayerSettings: null == miniPlayerSettings ? _self.miniPlayerSettings : miniPlayerSettings // ignore: cast_nullable_to_non_nullable +as MinimizedPlayerSettings,expandedPlayerSettings: null == expandedPlayerSettings ? _self.expandedPlayerSettings : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable +as ExpandedPlayerSettings,preferredDefaultVolume: null == preferredDefaultVolume ? _self.preferredDefaultVolume : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable +as double,preferredDefaultSpeed: null == preferredDefaultSpeed ? _self.preferredDefaultSpeed : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable +as double,speedOptions: null == speedOptions ? _self.speedOptions : speedOptions // ignore: cast_nullable_to_non_nullable +as List,speedIncrement: null == speedIncrement ? _self.speedIncrement : speedIncrement // ignore: cast_nullable_to_non_nullable +as double,minSpeed: null == minSpeed ? _self.minSpeed : minSpeed // ignore: cast_nullable_to_non_nullable +as double,maxSpeed: null == maxSpeed ? _self.maxSpeed : maxSpeed // ignore: cast_nullable_to_non_nullable +as double,minimumPositionForReporting: null == minimumPositionForReporting ? _self.minimumPositionForReporting : minimumPositionForReporting // ignore: cast_nullable_to_non_nullable +as Duration,playbackReportInterval: null == playbackReportInterval ? _self.playbackReportInterval : playbackReportInterval // ignore: cast_nullable_to_non_nullable +as Duration,markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft ? _self.markCompleteWhenTimeLeft : markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable +as Duration,configurePlayerForEveryBook: null == configurePlayerForEveryBook ? _self.configurePlayerForEveryBook : configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable +as bool, + )); +} +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings { + + return $MinimizedPlayerSettingsCopyWith<$Res>(_self.miniPlayerSettings, (value) { + return _then(_self.copyWith(miniPlayerSettings: value)); + }); +}/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings { + + return $ExpandedPlayerSettingsCopyWith<$Res>(_self.expandedPlayerSettings, (value) { + return _then(_self.copyWith(expandedPlayerSettings: value)); + }); +} } -/// @nodoc -abstract class _$$PlayerSettingsImplCopyWith<$Res> - implements $PlayerSettingsCopyWith<$Res> { - factory _$$PlayerSettingsImplCopyWith(_$PlayerSettingsImpl value, - $Res Function(_$PlayerSettingsImpl) then) = - __$$PlayerSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {MinimizedPlayerSettings miniPlayerSettings, - ExpandedPlayerSettings expandedPlayerSettings, - double preferredDefaultVolume, - double preferredDefaultSpeed, - List speedOptions, - double speedIncrement, - double minSpeed, - double maxSpeed, - Duration minimumPositionForReporting, - Duration playbackReportInterval, - Duration markCompleteWhenTimeLeft, - bool configurePlayerForEveryBook}); - @override - $MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings; - @override - $ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings; +/// Adds pattern-matching-related methods to [PlayerSettings]. +extension PlayerSettingsPatterns on PlayerSettings { +/// 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 Function( _PlayerSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PlayerSettings() 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 Function( _PlayerSettings value) $default,){ +final _that = this; +switch (_that) { +case _PlayerSettings(): +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? Function( _PlayerSettings value)? $default,){ +final _that = this; +switch (_that) { +case _PlayerSettings() 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 Function( MinimizedPlayerSettings miniPlayerSettings, ExpandedPlayerSettings expandedPlayerSettings, double preferredDefaultVolume, double preferredDefaultSpeed, List speedOptions, double speedIncrement, double minSpeed, double maxSpeed, Duration minimumPositionForReporting, Duration playbackReportInterval, Duration markCompleteWhenTimeLeft, bool configurePlayerForEveryBook)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PlayerSettings() when $default != null: +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.speedIncrement,_that.minSpeed,_that.maxSpeed,_that.minimumPositionForReporting,_that.playbackReportInterval,_that.markCompleteWhenTimeLeft,_that.configurePlayerForEveryBook);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 Function( MinimizedPlayerSettings miniPlayerSettings, ExpandedPlayerSettings expandedPlayerSettings, double preferredDefaultVolume, double preferredDefaultSpeed, List speedOptions, double speedIncrement, double minSpeed, double maxSpeed, Duration minimumPositionForReporting, Duration playbackReportInterval, Duration markCompleteWhenTimeLeft, bool configurePlayerForEveryBook) $default,) {final _that = this; +switch (_that) { +case _PlayerSettings(): +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.speedIncrement,_that.minSpeed,_that.maxSpeed,_that.minimumPositionForReporting,_that.playbackReportInterval,_that.markCompleteWhenTimeLeft,_that.configurePlayerForEveryBook);} +} +/// 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? Function( MinimizedPlayerSettings miniPlayerSettings, ExpandedPlayerSettings expandedPlayerSettings, double preferredDefaultVolume, double preferredDefaultSpeed, List speedOptions, double speedIncrement, double minSpeed, double maxSpeed, Duration minimumPositionForReporting, Duration playbackReportInterval, Duration markCompleteWhenTimeLeft, bool configurePlayerForEveryBook)? $default,) {final _that = this; +switch (_that) { +case _PlayerSettings() when $default != null: +return $default(_that.miniPlayerSettings,_that.expandedPlayerSettings,_that.preferredDefaultVolume,_that.preferredDefaultSpeed,_that.speedOptions,_that.speedIncrement,_that.minSpeed,_that.maxSpeed,_that.minimumPositionForReporting,_that.playbackReportInterval,_that.markCompleteWhenTimeLeft,_that.configurePlayerForEveryBook);case _: + return null; + +} } -/// @nodoc -class __$$PlayerSettingsImplCopyWithImpl<$Res> - extends _$PlayerSettingsCopyWithImpl<$Res, _$PlayerSettingsImpl> - implements _$$PlayerSettingsImplCopyWith<$Res> { - __$$PlayerSettingsImplCopyWithImpl( - _$PlayerSettingsImpl _value, $Res Function(_$PlayerSettingsImpl) _then) - : super(_value, _then); - - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? miniPlayerSettings = null, - Object? expandedPlayerSettings = null, - Object? preferredDefaultVolume = null, - Object? preferredDefaultSpeed = null, - Object? speedOptions = null, - Object? speedIncrement = null, - Object? minSpeed = null, - Object? maxSpeed = null, - Object? minimumPositionForReporting = null, - Object? playbackReportInterval = null, - Object? markCompleteWhenTimeLeft = null, - Object? configurePlayerForEveryBook = null, - }) { - return _then(_$PlayerSettingsImpl( - miniPlayerSettings: null == miniPlayerSettings - ? _value.miniPlayerSettings - : miniPlayerSettings // ignore: cast_nullable_to_non_nullable - as MinimizedPlayerSettings, - expandedPlayerSettings: null == expandedPlayerSettings - ? _value.expandedPlayerSettings - : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable - as ExpandedPlayerSettings, - preferredDefaultVolume: null == preferredDefaultVolume - ? _value.preferredDefaultVolume - : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable - as double, - preferredDefaultSpeed: null == preferredDefaultSpeed - ? _value.preferredDefaultSpeed - : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable - as double, - speedOptions: null == speedOptions - ? _value._speedOptions - : speedOptions // ignore: cast_nullable_to_non_nullable - as List, - speedIncrement: null == speedIncrement - ? _value.speedIncrement - : speedIncrement // ignore: cast_nullable_to_non_nullable - as double, - minSpeed: null == minSpeed - ? _value.minSpeed - : minSpeed // ignore: cast_nullable_to_non_nullable - as double, - maxSpeed: null == maxSpeed - ? _value.maxSpeed - : maxSpeed // ignore: cast_nullable_to_non_nullable - as double, - minimumPositionForReporting: null == minimumPositionForReporting - ? _value.minimumPositionForReporting - : minimumPositionForReporting // ignore: cast_nullable_to_non_nullable - as Duration, - playbackReportInterval: null == playbackReportInterval - ? _value.playbackReportInterval - : playbackReportInterval // ignore: cast_nullable_to_non_nullable - as Duration, - markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft - ? _value.markCompleteWhenTimeLeft - : markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable - as Duration, - configurePlayerForEveryBook: null == configurePlayerForEveryBook - ? _value.configurePlayerForEveryBook - : configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable - as bool, - )); - } } /// @nodoc @JsonSerializable() -class _$PlayerSettingsImpl implements _PlayerSettings { - const _$PlayerSettingsImpl( - {this.miniPlayerSettings = const MinimizedPlayerSettings(), - this.expandedPlayerSettings = const ExpandedPlayerSettings(), - this.preferredDefaultVolume = 1, - this.preferredDefaultSpeed = 1, - final List speedOptions = const [1, 1.25, 1.5, 1.75, 2], - this.speedIncrement = 0.05, - this.minSpeed = 0.1, - this.maxSpeed = 4, - this.minimumPositionForReporting = const Duration(seconds: 10), - this.playbackReportInterval = const Duration(seconds: 10), - this.markCompleteWhenTimeLeft = const Duration(seconds: 15), - this.configurePlayerForEveryBook = true}) - : _speedOptions = speedOptions; - factory _$PlayerSettingsImpl.fromJson(Map json) => - _$$PlayerSettingsImplFromJson(json); +class _PlayerSettings implements PlayerSettings { + const _PlayerSettings({this.miniPlayerSettings = const MinimizedPlayerSettings(), this.expandedPlayerSettings = const ExpandedPlayerSettings(), this.preferredDefaultVolume = 1, this.preferredDefaultSpeed = 1, final List speedOptions = const [1, 1.25, 1.5, 1.75, 2], this.speedIncrement = 0.05, this.minSpeed = 0.1, this.maxSpeed = 4, this.minimumPositionForReporting = const Duration(seconds: 10), this.playbackReportInterval = const Duration(seconds: 10), this.markCompleteWhenTimeLeft = const Duration(seconds: 15), this.configurePlayerForEveryBook = true}): _speedOptions = speedOptions; + factory _PlayerSettings.fromJson(Map json) => _$PlayerSettingsFromJson(json); - @override - @JsonKey() - final MinimizedPlayerSettings miniPlayerSettings; - @override - @JsonKey() - final ExpandedPlayerSettings expandedPlayerSettings; - @override - @JsonKey() - final double preferredDefaultVolume; - @override - @JsonKey() - final double preferredDefaultSpeed; - final List _speedOptions; - @override - @JsonKey() - List get speedOptions { - if (_speedOptions is EqualUnmodifiableListView) return _speedOptions; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_speedOptions); - } - - @override - @JsonKey() - final double speedIncrement; - @override - @JsonKey() - final double minSpeed; - @override - @JsonKey() - final double maxSpeed; - @override - @JsonKey() - final Duration minimumPositionForReporting; - @override - @JsonKey() - final Duration playbackReportInterval; - @override - @JsonKey() - final Duration markCompleteWhenTimeLeft; - @override - @JsonKey() - final bool configurePlayerForEveryBook; - - @override - String toString() { - return 'PlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, speedIncrement: $speedIncrement, minSpeed: $minSpeed, maxSpeed: $maxSpeed, minimumPositionForReporting: $minimumPositionForReporting, playbackReportInterval: $playbackReportInterval, markCompleteWhenTimeLeft: $markCompleteWhenTimeLeft, configurePlayerForEveryBook: $configurePlayerForEveryBook)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PlayerSettingsImpl && - (identical(other.miniPlayerSettings, miniPlayerSettings) || - other.miniPlayerSettings == miniPlayerSettings) && - (identical(other.expandedPlayerSettings, expandedPlayerSettings) || - other.expandedPlayerSettings == expandedPlayerSettings) && - (identical(other.preferredDefaultVolume, preferredDefaultVolume) || - other.preferredDefaultVolume == preferredDefaultVolume) && - (identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || - other.preferredDefaultSpeed == preferredDefaultSpeed) && - const DeepCollectionEquality() - .equals(other._speedOptions, _speedOptions) && - (identical(other.speedIncrement, speedIncrement) || - other.speedIncrement == speedIncrement) && - (identical(other.minSpeed, minSpeed) || - other.minSpeed == minSpeed) && - (identical(other.maxSpeed, maxSpeed) || - other.maxSpeed == maxSpeed) && - (identical(other.minimumPositionForReporting, - minimumPositionForReporting) || - other.minimumPositionForReporting == - minimumPositionForReporting) && - (identical(other.playbackReportInterval, playbackReportInterval) || - other.playbackReportInterval == playbackReportInterval) && - (identical( - other.markCompleteWhenTimeLeft, markCompleteWhenTimeLeft) || - other.markCompleteWhenTimeLeft == markCompleteWhenTimeLeft) && - (identical(other.configurePlayerForEveryBook, - configurePlayerForEveryBook) || - other.configurePlayerForEveryBook == - configurePlayerForEveryBook)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - miniPlayerSettings, - expandedPlayerSettings, - preferredDefaultVolume, - preferredDefaultSpeed, - const DeepCollectionEquality().hash(_speedOptions), - speedIncrement, - minSpeed, - maxSpeed, - minimumPositionForReporting, - playbackReportInterval, - markCompleteWhenTimeLeft, - configurePlayerForEveryBook); - - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PlayerSettingsImplCopyWith<_$PlayerSettingsImpl> get copyWith => - __$$PlayerSettingsImplCopyWithImpl<_$PlayerSettingsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$PlayerSettingsImplToJson( - this, - ); - } +@override@JsonKey() final MinimizedPlayerSettings miniPlayerSettings; +@override@JsonKey() final ExpandedPlayerSettings expandedPlayerSettings; +@override@JsonKey() final double preferredDefaultVolume; +@override@JsonKey() final double preferredDefaultSpeed; + final List _speedOptions; +@override@JsonKey() List get speedOptions { + if (_speedOptions is EqualUnmodifiableListView) return _speedOptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_speedOptions); } -abstract class _PlayerSettings implements PlayerSettings { - const factory _PlayerSettings( - {final MinimizedPlayerSettings miniPlayerSettings, - final ExpandedPlayerSettings expandedPlayerSettings, - final double preferredDefaultVolume, - final double preferredDefaultSpeed, - final List speedOptions, - final double speedIncrement, - final double minSpeed, - final double maxSpeed, - final Duration minimumPositionForReporting, - final Duration playbackReportInterval, - final Duration markCompleteWhenTimeLeft, - final bool configurePlayerForEveryBook}) = _$PlayerSettingsImpl; +@override@JsonKey() final double speedIncrement; +@override@JsonKey() final double minSpeed; +@override@JsonKey() final double maxSpeed; +@override@JsonKey() final Duration minimumPositionForReporting; +@override@JsonKey() final Duration playbackReportInterval; +@override@JsonKey() final Duration markCompleteWhenTimeLeft; +@override@JsonKey() final bool configurePlayerForEveryBook; - factory _PlayerSettings.fromJson(Map json) = - _$PlayerSettingsImpl.fromJson; +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PlayerSettingsCopyWith<_PlayerSettings> get copyWith => __$PlayerSettingsCopyWithImpl<_PlayerSettings>(this, _$identity); - @override - MinimizedPlayerSettings get miniPlayerSettings; - @override - ExpandedPlayerSettings get expandedPlayerSettings; - @override - double get preferredDefaultVolume; - @override - double get preferredDefaultSpeed; - @override - List get speedOptions; - @override - double get speedIncrement; - @override - double get minSpeed; - @override - double get maxSpeed; - @override - Duration get minimumPositionForReporting; - @override - Duration get playbackReportInterval; - @override - Duration get markCompleteWhenTimeLeft; - @override - bool get configurePlayerForEveryBook; - - /// Create a copy of PlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PlayerSettingsImplCopyWith<_$PlayerSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +Map toJson() { + return _$PlayerSettingsToJson(this, ); } -ExpandedPlayerSettings _$ExpandedPlayerSettingsFromJson( - Map json) { - return _ExpandedPlayerSettings.fromJson(json); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PlayerSettings&&(identical(other.miniPlayerSettings, miniPlayerSettings) || other.miniPlayerSettings == miniPlayerSettings)&&(identical(other.expandedPlayerSettings, expandedPlayerSettings) || other.expandedPlayerSettings == expandedPlayerSettings)&&(identical(other.preferredDefaultVolume, preferredDefaultVolume) || other.preferredDefaultVolume == preferredDefaultVolume)&&(identical(other.preferredDefaultSpeed, preferredDefaultSpeed) || other.preferredDefaultSpeed == preferredDefaultSpeed)&&const DeepCollectionEquality().equals(other._speedOptions, _speedOptions)&&(identical(other.speedIncrement, speedIncrement) || other.speedIncrement == speedIncrement)&&(identical(other.minSpeed, minSpeed) || other.minSpeed == minSpeed)&&(identical(other.maxSpeed, maxSpeed) || other.maxSpeed == maxSpeed)&&(identical(other.minimumPositionForReporting, minimumPositionForReporting) || other.minimumPositionForReporting == minimumPositionForReporting)&&(identical(other.playbackReportInterval, playbackReportInterval) || other.playbackReportInterval == playbackReportInterval)&&(identical(other.markCompleteWhenTimeLeft, markCompleteWhenTimeLeft) || other.markCompleteWhenTimeLeft == markCompleteWhenTimeLeft)&&(identical(other.configurePlayerForEveryBook, configurePlayerForEveryBook) || other.configurePlayerForEveryBook == configurePlayerForEveryBook)); } +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,miniPlayerSettings,expandedPlayerSettings,preferredDefaultVolume,preferredDefaultSpeed,const DeepCollectionEquality().hash(_speedOptions),speedIncrement,minSpeed,maxSpeed,minimumPositionForReporting,playbackReportInterval,markCompleteWhenTimeLeft,configurePlayerForEveryBook); + +@override +String toString() { + return 'PlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, speedIncrement: $speedIncrement, minSpeed: $minSpeed, maxSpeed: $maxSpeed, minimumPositionForReporting: $minimumPositionForReporting, playbackReportInterval: $playbackReportInterval, markCompleteWhenTimeLeft: $markCompleteWhenTimeLeft, configurePlayerForEveryBook: $configurePlayerForEveryBook)'; +} + + +} + +/// @nodoc +abstract mixin class _$PlayerSettingsCopyWith<$Res> implements $PlayerSettingsCopyWith<$Res> { + factory _$PlayerSettingsCopyWith(_PlayerSettings value, $Res Function(_PlayerSettings) _then) = __$PlayerSettingsCopyWithImpl; +@override @useResult +$Res call({ + MinimizedPlayerSettings miniPlayerSettings, ExpandedPlayerSettings expandedPlayerSettings, double preferredDefaultVolume, double preferredDefaultSpeed, List speedOptions, double speedIncrement, double minSpeed, double maxSpeed, Duration minimumPositionForReporting, Duration playbackReportInterval, Duration markCompleteWhenTimeLeft, bool configurePlayerForEveryBook +}); + + +@override $MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings;@override $ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings; + +} +/// @nodoc +class __$PlayerSettingsCopyWithImpl<$Res> + implements _$PlayerSettingsCopyWith<$Res> { + __$PlayerSettingsCopyWithImpl(this._self, this._then); + + final _PlayerSettings _self; + final $Res Function(_PlayerSettings) _then; + +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? miniPlayerSettings = null,Object? expandedPlayerSettings = null,Object? preferredDefaultVolume = null,Object? preferredDefaultSpeed = null,Object? speedOptions = null,Object? speedIncrement = null,Object? minSpeed = null,Object? maxSpeed = null,Object? minimumPositionForReporting = null,Object? playbackReportInterval = null,Object? markCompleteWhenTimeLeft = null,Object? configurePlayerForEveryBook = null,}) { + return _then(_PlayerSettings( +miniPlayerSettings: null == miniPlayerSettings ? _self.miniPlayerSettings : miniPlayerSettings // ignore: cast_nullable_to_non_nullable +as MinimizedPlayerSettings,expandedPlayerSettings: null == expandedPlayerSettings ? _self.expandedPlayerSettings : expandedPlayerSettings // ignore: cast_nullable_to_non_nullable +as ExpandedPlayerSettings,preferredDefaultVolume: null == preferredDefaultVolume ? _self.preferredDefaultVolume : preferredDefaultVolume // ignore: cast_nullable_to_non_nullable +as double,preferredDefaultSpeed: null == preferredDefaultSpeed ? _self.preferredDefaultSpeed : preferredDefaultSpeed // ignore: cast_nullable_to_non_nullable +as double,speedOptions: null == speedOptions ? _self._speedOptions : speedOptions // ignore: cast_nullable_to_non_nullable +as List,speedIncrement: null == speedIncrement ? _self.speedIncrement : speedIncrement // ignore: cast_nullable_to_non_nullable +as double,minSpeed: null == minSpeed ? _self.minSpeed : minSpeed // ignore: cast_nullable_to_non_nullable +as double,maxSpeed: null == maxSpeed ? _self.maxSpeed : maxSpeed // ignore: cast_nullable_to_non_nullable +as double,minimumPositionForReporting: null == minimumPositionForReporting ? _self.minimumPositionForReporting : minimumPositionForReporting // ignore: cast_nullable_to_non_nullable +as Duration,playbackReportInterval: null == playbackReportInterval ? _self.playbackReportInterval : playbackReportInterval // ignore: cast_nullable_to_non_nullable +as Duration,markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft ? _self.markCompleteWhenTimeLeft : markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable +as Duration,configurePlayerForEveryBook: null == configurePlayerForEveryBook ? _self.configurePlayerForEveryBook : configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings { + + return $MinimizedPlayerSettingsCopyWith<$Res>(_self.miniPlayerSettings, (value) { + return _then(_self.copyWith(miniPlayerSettings: value)); + }); +}/// Create a copy of PlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ExpandedPlayerSettingsCopyWith<$Res> get expandedPlayerSettings { + + return $ExpandedPlayerSettingsCopyWith<$Res>(_self.expandedPlayerSettings, (value) { + return _then(_self.copyWith(expandedPlayerSettings: value)); + }); +} +} + + /// @nodoc mixin _$ExpandedPlayerSettings { - bool get showTotalProgress => throw _privateConstructorUsedError; - bool get showChapterProgress => throw _privateConstructorUsedError; + + bool get showTotalProgress; bool get showChapterProgress; +/// Create a copy of ExpandedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ExpandedPlayerSettingsCopyWith get copyWith => _$ExpandedPlayerSettingsCopyWithImpl(this as ExpandedPlayerSettings, _$identity); /// Serializes this ExpandedPlayerSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ExpandedPlayerSettings&&(identical(other.showTotalProgress, showTotalProgress) || other.showTotalProgress == showTotalProgress)&&(identical(other.showChapterProgress, showChapterProgress) || other.showChapterProgress == showChapterProgress)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,showTotalProgress,showChapterProgress); + +@override +String toString() { + return 'ExpandedPlayerSettings(showTotalProgress: $showTotalProgress, showChapterProgress: $showChapterProgress)'; +} + - /// Create a copy of ExpandedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ExpandedPlayerSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $ExpandedPlayerSettingsCopyWith<$Res> { - factory $ExpandedPlayerSettingsCopyWith(ExpandedPlayerSettings value, - $Res Function(ExpandedPlayerSettings) then) = - _$ExpandedPlayerSettingsCopyWithImpl<$Res, ExpandedPlayerSettings>; - @useResult - $Res call({bool showTotalProgress, bool showChapterProgress}); -} +abstract mixin class $ExpandedPlayerSettingsCopyWith<$Res> { + factory $ExpandedPlayerSettingsCopyWith(ExpandedPlayerSettings value, $Res Function(ExpandedPlayerSettings) _then) = _$ExpandedPlayerSettingsCopyWithImpl; +@useResult +$Res call({ + bool showTotalProgress, bool showChapterProgress +}); + + + +} /// @nodoc -class _$ExpandedPlayerSettingsCopyWithImpl<$Res, - $Val extends ExpandedPlayerSettings> +class _$ExpandedPlayerSettingsCopyWithImpl<$Res> implements $ExpandedPlayerSettingsCopyWith<$Res> { - _$ExpandedPlayerSettingsCopyWithImpl(this._value, this._then); + _$ExpandedPlayerSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final ExpandedPlayerSettings _self; + final $Res Function(ExpandedPlayerSettings) _then; - /// Create a copy of ExpandedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? showTotalProgress = null, - Object? showChapterProgress = null, - }) { - return _then(_value.copyWith( - showTotalProgress: null == showTotalProgress - ? _value.showTotalProgress - : showTotalProgress // ignore: cast_nullable_to_non_nullable - as bool, - showChapterProgress: null == showChapterProgress - ? _value.showChapterProgress - : showChapterProgress // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } +/// Create a copy of ExpandedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? showTotalProgress = null,Object? showChapterProgress = null,}) { + return _then(_self.copyWith( +showTotalProgress: null == showTotalProgress ? _self.showTotalProgress : showTotalProgress // ignore: cast_nullable_to_non_nullable +as bool,showChapterProgress: null == showChapterProgress ? _self.showChapterProgress : showChapterProgress // ignore: cast_nullable_to_non_nullable +as bool, + )); } -/// @nodoc -abstract class _$$ExpandedPlayerSettingsImplCopyWith<$Res> - implements $ExpandedPlayerSettingsCopyWith<$Res> { - factory _$$ExpandedPlayerSettingsImplCopyWith( - _$ExpandedPlayerSettingsImpl value, - $Res Function(_$ExpandedPlayerSettingsImpl) then) = - __$$ExpandedPlayerSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({bool showTotalProgress, bool showChapterProgress}); } -/// @nodoc -class __$$ExpandedPlayerSettingsImplCopyWithImpl<$Res> - extends _$ExpandedPlayerSettingsCopyWithImpl<$Res, - _$ExpandedPlayerSettingsImpl> - implements _$$ExpandedPlayerSettingsImplCopyWith<$Res> { - __$$ExpandedPlayerSettingsImplCopyWithImpl( - _$ExpandedPlayerSettingsImpl _value, - $Res Function(_$ExpandedPlayerSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of ExpandedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? showTotalProgress = null, - Object? showChapterProgress = null, - }) { - return _then(_$ExpandedPlayerSettingsImpl( - showTotalProgress: null == showTotalProgress - ? _value.showTotalProgress - : showTotalProgress // ignore: cast_nullable_to_non_nullable - as bool, - showChapterProgress: null == showChapterProgress - ? _value.showChapterProgress - : showChapterProgress // ignore: cast_nullable_to_non_nullable - as bool, - )); - } +/// Adds pattern-matching-related methods to [ExpandedPlayerSettings]. +extension ExpandedPlayerSettingsPatterns on ExpandedPlayerSettings { +/// 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 Function( _ExpandedPlayerSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ExpandedPlayerSettings() 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 Function( _ExpandedPlayerSettings value) $default,){ +final _that = this; +switch (_that) { +case _ExpandedPlayerSettings(): +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? Function( _ExpandedPlayerSettings value)? $default,){ +final _that = this; +switch (_that) { +case _ExpandedPlayerSettings() 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 Function( bool showTotalProgress, bool showChapterProgress)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ExpandedPlayerSettings() when $default != null: +return $default(_that.showTotalProgress,_that.showChapterProgress);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 Function( bool showTotalProgress, bool showChapterProgress) $default,) {final _that = this; +switch (_that) { +case _ExpandedPlayerSettings(): +return $default(_that.showTotalProgress,_that.showChapterProgress);} +} +/// 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? Function( bool showTotalProgress, bool showChapterProgress)? $default,) {final _that = this; +switch (_that) { +case _ExpandedPlayerSettings() when $default != null: +return $default(_that.showTotalProgress,_that.showChapterProgress);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$ExpandedPlayerSettingsImpl implements _ExpandedPlayerSettings { - const _$ExpandedPlayerSettingsImpl( - {this.showTotalProgress = false, this.showChapterProgress = true}); - factory _$ExpandedPlayerSettingsImpl.fromJson(Map json) => - _$$ExpandedPlayerSettingsImplFromJson(json); +class _ExpandedPlayerSettings implements ExpandedPlayerSettings { + const _ExpandedPlayerSettings({this.showTotalProgress = false, this.showChapterProgress = true}); + factory _ExpandedPlayerSettings.fromJson(Map json) => _$ExpandedPlayerSettingsFromJson(json); - @override - @JsonKey() - final bool showTotalProgress; - @override - @JsonKey() - final bool showChapterProgress; +@override@JsonKey() final bool showTotalProgress; +@override@JsonKey() final bool showChapterProgress; - @override - String toString() { - return 'ExpandedPlayerSettings(showTotalProgress: $showTotalProgress, showChapterProgress: $showChapterProgress)'; - } +/// Create a copy of ExpandedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ExpandedPlayerSettingsCopyWith<_ExpandedPlayerSettings> get copyWith => __$ExpandedPlayerSettingsCopyWithImpl<_ExpandedPlayerSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ExpandedPlayerSettingsImpl && - (identical(other.showTotalProgress, showTotalProgress) || - other.showTotalProgress == showTotalProgress) && - (identical(other.showChapterProgress, showChapterProgress) || - other.showChapterProgress == showChapterProgress)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, showTotalProgress, showChapterProgress); - - /// Create a copy of ExpandedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ExpandedPlayerSettingsImplCopyWith<_$ExpandedPlayerSettingsImpl> - get copyWith => __$$ExpandedPlayerSettingsImplCopyWithImpl< - _$ExpandedPlayerSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ExpandedPlayerSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$ExpandedPlayerSettingsToJson(this, ); } -abstract class _ExpandedPlayerSettings implements ExpandedPlayerSettings { - const factory _ExpandedPlayerSettings( - {final bool showTotalProgress, - final bool showChapterProgress}) = _$ExpandedPlayerSettingsImpl; - - factory _ExpandedPlayerSettings.fromJson(Map json) = - _$ExpandedPlayerSettingsImpl.fromJson; - - @override - bool get showTotalProgress; - @override - bool get showChapterProgress; - - /// Create a copy of ExpandedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ExpandedPlayerSettingsImplCopyWith<_$ExpandedPlayerSettingsImpl> - get copyWith => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExpandedPlayerSettings&&(identical(other.showTotalProgress, showTotalProgress) || other.showTotalProgress == showTotalProgress)&&(identical(other.showChapterProgress, showChapterProgress) || other.showChapterProgress == showChapterProgress)); } -MinimizedPlayerSettings _$MinimizedPlayerSettingsFromJson( - Map json) { - return _MinimizedPlayerSettings.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,showTotalProgress,showChapterProgress); + +@override +String toString() { + return 'ExpandedPlayerSettings(showTotalProgress: $showTotalProgress, showChapterProgress: $showChapterProgress)'; } + +} + +/// @nodoc +abstract mixin class _$ExpandedPlayerSettingsCopyWith<$Res> implements $ExpandedPlayerSettingsCopyWith<$Res> { + factory _$ExpandedPlayerSettingsCopyWith(_ExpandedPlayerSettings value, $Res Function(_ExpandedPlayerSettings) _then) = __$ExpandedPlayerSettingsCopyWithImpl; +@override @useResult +$Res call({ + bool showTotalProgress, bool showChapterProgress +}); + + + + +} +/// @nodoc +class __$ExpandedPlayerSettingsCopyWithImpl<$Res> + implements _$ExpandedPlayerSettingsCopyWith<$Res> { + __$ExpandedPlayerSettingsCopyWithImpl(this._self, this._then); + + final _ExpandedPlayerSettings _self; + final $Res Function(_ExpandedPlayerSettings) _then; + +/// Create a copy of ExpandedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? showTotalProgress = null,Object? showChapterProgress = null,}) { + return _then(_ExpandedPlayerSettings( +showTotalProgress: null == showTotalProgress ? _self.showTotalProgress : showTotalProgress // ignore: cast_nullable_to_non_nullable +as bool,showChapterProgress: null == showChapterProgress ? _self.showChapterProgress : showChapterProgress // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + /// @nodoc mixin _$MinimizedPlayerSettings { - bool get useChapterInfo => throw _privateConstructorUsedError; + + bool get useChapterInfo; +/// Create a copy of MinimizedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MinimizedPlayerSettingsCopyWith get copyWith => _$MinimizedPlayerSettingsCopyWithImpl(this as MinimizedPlayerSettings, _$identity); /// Serializes this MinimizedPlayerSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MinimizedPlayerSettings&&(identical(other.useChapterInfo, useChapterInfo) || other.useChapterInfo == useChapterInfo)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,useChapterInfo); + +@override +String toString() { + return 'MinimizedPlayerSettings(useChapterInfo: $useChapterInfo)'; +} + - /// Create a copy of MinimizedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $MinimizedPlayerSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $MinimizedPlayerSettingsCopyWith<$Res> { - factory $MinimizedPlayerSettingsCopyWith(MinimizedPlayerSettings value, - $Res Function(MinimizedPlayerSettings) then) = - _$MinimizedPlayerSettingsCopyWithImpl<$Res, MinimizedPlayerSettings>; - @useResult - $Res call({bool useChapterInfo}); -} +abstract mixin class $MinimizedPlayerSettingsCopyWith<$Res> { + factory $MinimizedPlayerSettingsCopyWith(MinimizedPlayerSettings value, $Res Function(MinimizedPlayerSettings) _then) = _$MinimizedPlayerSettingsCopyWithImpl; +@useResult +$Res call({ + bool useChapterInfo +}); + + + +} /// @nodoc -class _$MinimizedPlayerSettingsCopyWithImpl<$Res, - $Val extends MinimizedPlayerSettings> +class _$MinimizedPlayerSettingsCopyWithImpl<$Res> implements $MinimizedPlayerSettingsCopyWith<$Res> { - _$MinimizedPlayerSettingsCopyWithImpl(this._value, this._then); + _$MinimizedPlayerSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MinimizedPlayerSettings _self; + final $Res Function(MinimizedPlayerSettings) _then; - /// Create a copy of MinimizedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? useChapterInfo = null, - }) { - return _then(_value.copyWith( - useChapterInfo: null == useChapterInfo - ? _value.useChapterInfo - : useChapterInfo // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } +/// Create a copy of MinimizedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? useChapterInfo = null,}) { + return _then(_self.copyWith( +useChapterInfo: null == useChapterInfo ? _self.useChapterInfo : useChapterInfo // ignore: cast_nullable_to_non_nullable +as bool, + )); } -/// @nodoc -abstract class _$$MinimizedPlayerSettingsImplCopyWith<$Res> - implements $MinimizedPlayerSettingsCopyWith<$Res> { - factory _$$MinimizedPlayerSettingsImplCopyWith( - _$MinimizedPlayerSettingsImpl value, - $Res Function(_$MinimizedPlayerSettingsImpl) then) = - __$$MinimizedPlayerSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({bool useChapterInfo}); } -/// @nodoc -class __$$MinimizedPlayerSettingsImplCopyWithImpl<$Res> - extends _$MinimizedPlayerSettingsCopyWithImpl<$Res, - _$MinimizedPlayerSettingsImpl> - implements _$$MinimizedPlayerSettingsImplCopyWith<$Res> { - __$$MinimizedPlayerSettingsImplCopyWithImpl( - _$MinimizedPlayerSettingsImpl _value, - $Res Function(_$MinimizedPlayerSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of MinimizedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? useChapterInfo = null, - }) { - return _then(_$MinimizedPlayerSettingsImpl( - useChapterInfo: null == useChapterInfo - ? _value.useChapterInfo - : useChapterInfo // ignore: cast_nullable_to_non_nullable - as bool, - )); - } +/// Adds pattern-matching-related methods to [MinimizedPlayerSettings]. +extension MinimizedPlayerSettingsPatterns on MinimizedPlayerSettings { +/// 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 Function( _MinimizedPlayerSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MinimizedPlayerSettings() 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 Function( _MinimizedPlayerSettings value) $default,){ +final _that = this; +switch (_that) { +case _MinimizedPlayerSettings(): +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? Function( _MinimizedPlayerSettings value)? $default,){ +final _that = this; +switch (_that) { +case _MinimizedPlayerSettings() 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 Function( bool useChapterInfo)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MinimizedPlayerSettings() when $default != null: +return $default(_that.useChapterInfo);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 Function( bool useChapterInfo) $default,) {final _that = this; +switch (_that) { +case _MinimizedPlayerSettings(): +return $default(_that.useChapterInfo);} +} +/// 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? Function( bool useChapterInfo)? $default,) {final _that = this; +switch (_that) { +case _MinimizedPlayerSettings() when $default != null: +return $default(_that.useChapterInfo);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MinimizedPlayerSettingsImpl implements _MinimizedPlayerSettings { - const _$MinimizedPlayerSettingsImpl({this.useChapterInfo = false}); - factory _$MinimizedPlayerSettingsImpl.fromJson(Map json) => - _$$MinimizedPlayerSettingsImplFromJson(json); +class _MinimizedPlayerSettings implements MinimizedPlayerSettings { + const _MinimizedPlayerSettings({this.useChapterInfo = false}); + factory _MinimizedPlayerSettings.fromJson(Map json) => _$MinimizedPlayerSettingsFromJson(json); - @override - @JsonKey() - final bool useChapterInfo; +@override@JsonKey() final bool useChapterInfo; - @override - String toString() { - return 'MinimizedPlayerSettings(useChapterInfo: $useChapterInfo)'; - } +/// Create a copy of MinimizedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MinimizedPlayerSettingsCopyWith<_MinimizedPlayerSettings> get copyWith => __$MinimizedPlayerSettingsCopyWithImpl<_MinimizedPlayerSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MinimizedPlayerSettingsImpl && - (identical(other.useChapterInfo, useChapterInfo) || - other.useChapterInfo == useChapterInfo)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, useChapterInfo); - - /// Create a copy of MinimizedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$MinimizedPlayerSettingsImplCopyWith<_$MinimizedPlayerSettingsImpl> - get copyWith => __$$MinimizedPlayerSettingsImplCopyWithImpl< - _$MinimizedPlayerSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MinimizedPlayerSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$MinimizedPlayerSettingsToJson(this, ); } -abstract class _MinimizedPlayerSettings implements MinimizedPlayerSettings { - const factory _MinimizedPlayerSettings({final bool useChapterInfo}) = - _$MinimizedPlayerSettingsImpl; - - factory _MinimizedPlayerSettings.fromJson(Map json) = - _$MinimizedPlayerSettingsImpl.fromJson; - - @override - bool get useChapterInfo; - - /// Create a copy of MinimizedPlayerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MinimizedPlayerSettingsImplCopyWith<_$MinimizedPlayerSettingsImpl> - get copyWith => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MinimizedPlayerSettings&&(identical(other.useChapterInfo, useChapterInfo) || other.useChapterInfo == useChapterInfo)); } -SleepTimerSettings _$SleepTimerSettingsFromJson(Map json) { - return _SleepTimerSettings.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,useChapterInfo); + +@override +String toString() { + return 'MinimizedPlayerSettings(useChapterInfo: $useChapterInfo)'; } + +} + +/// @nodoc +abstract mixin class _$MinimizedPlayerSettingsCopyWith<$Res> implements $MinimizedPlayerSettingsCopyWith<$Res> { + factory _$MinimizedPlayerSettingsCopyWith(_MinimizedPlayerSettings value, $Res Function(_MinimizedPlayerSettings) _then) = __$MinimizedPlayerSettingsCopyWithImpl; +@override @useResult +$Res call({ + bool useChapterInfo +}); + + + + +} +/// @nodoc +class __$MinimizedPlayerSettingsCopyWithImpl<$Res> + implements _$MinimizedPlayerSettingsCopyWith<$Res> { + __$MinimizedPlayerSettingsCopyWithImpl(this._self, this._then); + + final _MinimizedPlayerSettings _self; + final $Res Function(_MinimizedPlayerSettings) _then; + +/// Create a copy of MinimizedPlayerSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? useChapterInfo = null,}) { + return _then(_MinimizedPlayerSettings( +useChapterInfo: null == useChapterInfo ? _self.useChapterInfo : useChapterInfo // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + /// @nodoc mixin _$SleepTimerSettings { - Duration get defaultDuration => throw _privateConstructorUsedError; - List get presetDurations => throw _privateConstructorUsedError; - Duration get maxDuration => throw _privateConstructorUsedError; - bool get fadeOutAudio => throw _privateConstructorUsedError; - Duration get fadeOutDuration => throw _privateConstructorUsedError; - /// if true, the player will automatically rewind the audio when the sleep timer is stopped - bool get autoRewindWhenStopped => throw _privateConstructorUsedError; - - /// the key is the duration in minutes - Map get autoRewindDurations => - throw _privateConstructorUsedError; - - /// auto turn on timer settings - bool get autoTurnOnTimer => throw _privateConstructorUsedError; - - /// always auto turn on timer settings or during specific times - bool get alwaysAutoTurnOnTimer => throw _privateConstructorUsedError; - - /// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false - /// - /// duration is the time from 00:00 - Duration get autoTurnOnTime => throw _privateConstructorUsedError; - Duration get autoTurnOffTime => throw _privateConstructorUsedError; + Duration get defaultDuration; List get presetDurations; Duration get maxDuration; bool get fadeOutAudio; Duration get fadeOutDuration;/// if true, the player will automatically rewind the audio when the sleep timer is stopped + bool get autoRewindWhenStopped;/// the key is the duration in minutes + Map get autoRewindDurations;/// auto turn on timer settings + bool get autoTurnOnTimer;/// always auto turn on timer settings or during specific times + bool get alwaysAutoTurnOnTimer;/// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false +/// +/// duration is the time from 00:00 + Duration get autoTurnOnTime; Duration get autoTurnOffTime; +/// Create a copy of SleepTimerSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SleepTimerSettingsCopyWith get copyWith => _$SleepTimerSettingsCopyWithImpl(this as SleepTimerSettings, _$identity); /// Serializes this SleepTimerSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SleepTimerSettings&&(identical(other.defaultDuration, defaultDuration) || other.defaultDuration == defaultDuration)&&const DeepCollectionEquality().equals(other.presetDurations, presetDurations)&&(identical(other.maxDuration, maxDuration) || other.maxDuration == maxDuration)&&(identical(other.fadeOutAudio, fadeOutAudio) || other.fadeOutAudio == fadeOutAudio)&&(identical(other.fadeOutDuration, fadeOutDuration) || other.fadeOutDuration == fadeOutDuration)&&(identical(other.autoRewindWhenStopped, autoRewindWhenStopped) || other.autoRewindWhenStopped == autoRewindWhenStopped)&&const DeepCollectionEquality().equals(other.autoRewindDurations, autoRewindDurations)&&(identical(other.autoTurnOnTimer, autoTurnOnTimer) || other.autoTurnOnTimer == autoTurnOnTimer)&&(identical(other.alwaysAutoTurnOnTimer, alwaysAutoTurnOnTimer) || other.alwaysAutoTurnOnTimer == alwaysAutoTurnOnTimer)&&(identical(other.autoTurnOnTime, autoTurnOnTime) || other.autoTurnOnTime == autoTurnOnTime)&&(identical(other.autoTurnOffTime, autoTurnOffTime) || other.autoTurnOffTime == autoTurnOffTime)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,defaultDuration,const DeepCollectionEquality().hash(presetDurations),maxDuration,fadeOutAudio,fadeOutDuration,autoRewindWhenStopped,const DeepCollectionEquality().hash(autoRewindDurations),autoTurnOnTimer,alwaysAutoTurnOnTimer,autoTurnOnTime,autoTurnOffTime); + +@override +String toString() { + return 'SleepTimerSettings(defaultDuration: $defaultDuration, presetDurations: $presetDurations, maxDuration: $maxDuration, fadeOutAudio: $fadeOutAudio, fadeOutDuration: $fadeOutDuration, autoRewindWhenStopped: $autoRewindWhenStopped, autoRewindDurations: $autoRewindDurations, autoTurnOnTimer: $autoTurnOnTimer, alwaysAutoTurnOnTimer: $alwaysAutoTurnOnTimer, autoTurnOnTime: $autoTurnOnTime, autoTurnOffTime: $autoTurnOffTime)'; +} + - /// Create a copy of SleepTimerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $SleepTimerSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $SleepTimerSettingsCopyWith<$Res> { - factory $SleepTimerSettingsCopyWith( - SleepTimerSettings value, $Res Function(SleepTimerSettings) then) = - _$SleepTimerSettingsCopyWithImpl<$Res, SleepTimerSettings>; - @useResult - $Res call( - {Duration defaultDuration, - List presetDurations, - Duration maxDuration, - bool fadeOutAudio, - Duration fadeOutDuration, - bool autoRewindWhenStopped, - Map autoRewindDurations, - bool autoTurnOnTimer, - bool alwaysAutoTurnOnTimer, - Duration autoTurnOnTime, - Duration autoTurnOffTime}); -} +abstract mixin class $SleepTimerSettingsCopyWith<$Res> { + factory $SleepTimerSettingsCopyWith(SleepTimerSettings value, $Res Function(SleepTimerSettings) _then) = _$SleepTimerSettingsCopyWithImpl; +@useResult +$Res call({ + Duration defaultDuration, List presetDurations, Duration maxDuration, bool fadeOutAudio, Duration fadeOutDuration, bool autoRewindWhenStopped, Map autoRewindDurations, bool autoTurnOnTimer, bool alwaysAutoTurnOnTimer, Duration autoTurnOnTime, Duration autoTurnOffTime +}); + + + +} /// @nodoc -class _$SleepTimerSettingsCopyWithImpl<$Res, $Val extends SleepTimerSettings> +class _$SleepTimerSettingsCopyWithImpl<$Res> implements $SleepTimerSettingsCopyWith<$Res> { - _$SleepTimerSettingsCopyWithImpl(this._value, this._then); + _$SleepTimerSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final SleepTimerSettings _self; + final $Res Function(SleepTimerSettings) _then; - /// Create a copy of SleepTimerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? defaultDuration = null, - Object? presetDurations = null, - Object? maxDuration = null, - Object? fadeOutAudio = null, - Object? fadeOutDuration = null, - Object? autoRewindWhenStopped = null, - Object? autoRewindDurations = null, - Object? autoTurnOnTimer = null, - Object? alwaysAutoTurnOnTimer = null, - Object? autoTurnOnTime = null, - Object? autoTurnOffTime = null, - }) { - return _then(_value.copyWith( - defaultDuration: null == defaultDuration - ? _value.defaultDuration - : defaultDuration // ignore: cast_nullable_to_non_nullable - as Duration, - presetDurations: null == presetDurations - ? _value.presetDurations - : presetDurations // ignore: cast_nullable_to_non_nullable - as List, - maxDuration: null == maxDuration - ? _value.maxDuration - : maxDuration // ignore: cast_nullable_to_non_nullable - as Duration, - fadeOutAudio: null == fadeOutAudio - ? _value.fadeOutAudio - : fadeOutAudio // ignore: cast_nullable_to_non_nullable - as bool, - fadeOutDuration: null == fadeOutDuration - ? _value.fadeOutDuration - : fadeOutDuration // ignore: cast_nullable_to_non_nullable - as Duration, - autoRewindWhenStopped: null == autoRewindWhenStopped - ? _value.autoRewindWhenStopped - : autoRewindWhenStopped // ignore: cast_nullable_to_non_nullable - as bool, - autoRewindDurations: null == autoRewindDurations - ? _value.autoRewindDurations - : autoRewindDurations // ignore: cast_nullable_to_non_nullable - as Map, - autoTurnOnTimer: null == autoTurnOnTimer - ? _value.autoTurnOnTimer - : autoTurnOnTimer // ignore: cast_nullable_to_non_nullable - as bool, - alwaysAutoTurnOnTimer: null == alwaysAutoTurnOnTimer - ? _value.alwaysAutoTurnOnTimer - : alwaysAutoTurnOnTimer // ignore: cast_nullable_to_non_nullable - as bool, - autoTurnOnTime: null == autoTurnOnTime - ? _value.autoTurnOnTime - : autoTurnOnTime // ignore: cast_nullable_to_non_nullable - as Duration, - autoTurnOffTime: null == autoTurnOffTime - ? _value.autoTurnOffTime - : autoTurnOffTime // ignore: cast_nullable_to_non_nullable - as Duration, - ) as $Val); - } +/// Create a copy of SleepTimerSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? defaultDuration = null,Object? presetDurations = null,Object? maxDuration = null,Object? fadeOutAudio = null,Object? fadeOutDuration = null,Object? autoRewindWhenStopped = null,Object? autoRewindDurations = null,Object? autoTurnOnTimer = null,Object? alwaysAutoTurnOnTimer = null,Object? autoTurnOnTime = null,Object? autoTurnOffTime = null,}) { + return _then(_self.copyWith( +defaultDuration: null == defaultDuration ? _self.defaultDuration : defaultDuration // ignore: cast_nullable_to_non_nullable +as Duration,presetDurations: null == presetDurations ? _self.presetDurations : presetDurations // ignore: cast_nullable_to_non_nullable +as List,maxDuration: null == maxDuration ? _self.maxDuration : maxDuration // ignore: cast_nullable_to_non_nullable +as Duration,fadeOutAudio: null == fadeOutAudio ? _self.fadeOutAudio : fadeOutAudio // ignore: cast_nullable_to_non_nullable +as bool,fadeOutDuration: null == fadeOutDuration ? _self.fadeOutDuration : fadeOutDuration // ignore: cast_nullable_to_non_nullable +as Duration,autoRewindWhenStopped: null == autoRewindWhenStopped ? _self.autoRewindWhenStopped : autoRewindWhenStopped // ignore: cast_nullable_to_non_nullable +as bool,autoRewindDurations: null == autoRewindDurations ? _self.autoRewindDurations : autoRewindDurations // ignore: cast_nullable_to_non_nullable +as Map,autoTurnOnTimer: null == autoTurnOnTimer ? _self.autoTurnOnTimer : autoTurnOnTimer // ignore: cast_nullable_to_non_nullable +as bool,alwaysAutoTurnOnTimer: null == alwaysAutoTurnOnTimer ? _self.alwaysAutoTurnOnTimer : alwaysAutoTurnOnTimer // ignore: cast_nullable_to_non_nullable +as bool,autoTurnOnTime: null == autoTurnOnTime ? _self.autoTurnOnTime : autoTurnOnTime // ignore: cast_nullable_to_non_nullable +as Duration,autoTurnOffTime: null == autoTurnOffTime ? _self.autoTurnOffTime : autoTurnOffTime // ignore: cast_nullable_to_non_nullable +as Duration, + )); } -/// @nodoc -abstract class _$$SleepTimerSettingsImplCopyWith<$Res> - implements $SleepTimerSettingsCopyWith<$Res> { - factory _$$SleepTimerSettingsImplCopyWith(_$SleepTimerSettingsImpl value, - $Res Function(_$SleepTimerSettingsImpl) then) = - __$$SleepTimerSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {Duration defaultDuration, - List presetDurations, - Duration maxDuration, - bool fadeOutAudio, - Duration fadeOutDuration, - bool autoRewindWhenStopped, - Map autoRewindDurations, - bool autoTurnOnTimer, - bool alwaysAutoTurnOnTimer, - Duration autoTurnOnTime, - Duration autoTurnOffTime}); } -/// @nodoc -class __$$SleepTimerSettingsImplCopyWithImpl<$Res> - extends _$SleepTimerSettingsCopyWithImpl<$Res, _$SleepTimerSettingsImpl> - implements _$$SleepTimerSettingsImplCopyWith<$Res> { - __$$SleepTimerSettingsImplCopyWithImpl(_$SleepTimerSettingsImpl _value, - $Res Function(_$SleepTimerSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of SleepTimerSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? defaultDuration = null, - Object? presetDurations = null, - Object? maxDuration = null, - Object? fadeOutAudio = null, - Object? fadeOutDuration = null, - Object? autoRewindWhenStopped = null, - Object? autoRewindDurations = null, - Object? autoTurnOnTimer = null, - Object? alwaysAutoTurnOnTimer = null, - Object? autoTurnOnTime = null, - Object? autoTurnOffTime = null, - }) { - return _then(_$SleepTimerSettingsImpl( - defaultDuration: null == defaultDuration - ? _value.defaultDuration - : defaultDuration // ignore: cast_nullable_to_non_nullable - as Duration, - presetDurations: null == presetDurations - ? _value._presetDurations - : presetDurations // ignore: cast_nullable_to_non_nullable - as List, - maxDuration: null == maxDuration - ? _value.maxDuration - : maxDuration // ignore: cast_nullable_to_non_nullable - as Duration, - fadeOutAudio: null == fadeOutAudio - ? _value.fadeOutAudio - : fadeOutAudio // ignore: cast_nullable_to_non_nullable - as bool, - fadeOutDuration: null == fadeOutDuration - ? _value.fadeOutDuration - : fadeOutDuration // ignore: cast_nullable_to_non_nullable - as Duration, - autoRewindWhenStopped: null == autoRewindWhenStopped - ? _value.autoRewindWhenStopped - : autoRewindWhenStopped // ignore: cast_nullable_to_non_nullable - as bool, - autoRewindDurations: null == autoRewindDurations - ? _value._autoRewindDurations - : autoRewindDurations // ignore: cast_nullable_to_non_nullable - as Map, - autoTurnOnTimer: null == autoTurnOnTimer - ? _value.autoTurnOnTimer - : autoTurnOnTimer // ignore: cast_nullable_to_non_nullable - as bool, - alwaysAutoTurnOnTimer: null == alwaysAutoTurnOnTimer - ? _value.alwaysAutoTurnOnTimer - : alwaysAutoTurnOnTimer // ignore: cast_nullable_to_non_nullable - as bool, - autoTurnOnTime: null == autoTurnOnTime - ? _value.autoTurnOnTime - : autoTurnOnTime // ignore: cast_nullable_to_non_nullable - as Duration, - autoTurnOffTime: null == autoTurnOffTime - ? _value.autoTurnOffTime - : autoTurnOffTime // ignore: cast_nullable_to_non_nullable - as Duration, - )); - } +/// Adds pattern-matching-related methods to [SleepTimerSettings]. +extension SleepTimerSettingsPatterns on SleepTimerSettings { +/// 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 Function( _SleepTimerSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SleepTimerSettings() 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 Function( _SleepTimerSettings value) $default,){ +final _that = this; +switch (_that) { +case _SleepTimerSettings(): +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? Function( _SleepTimerSettings value)? $default,){ +final _that = this; +switch (_that) { +case _SleepTimerSettings() 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 Function( Duration defaultDuration, List presetDurations, Duration maxDuration, bool fadeOutAudio, Duration fadeOutDuration, bool autoRewindWhenStopped, Map autoRewindDurations, bool autoTurnOnTimer, bool alwaysAutoTurnOnTimer, Duration autoTurnOnTime, Duration autoTurnOffTime)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SleepTimerSettings() when $default != null: +return $default(_that.defaultDuration,_that.presetDurations,_that.maxDuration,_that.fadeOutAudio,_that.fadeOutDuration,_that.autoRewindWhenStopped,_that.autoRewindDurations,_that.autoTurnOnTimer,_that.alwaysAutoTurnOnTimer,_that.autoTurnOnTime,_that.autoTurnOffTime);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 Function( Duration defaultDuration, List presetDurations, Duration maxDuration, bool fadeOutAudio, Duration fadeOutDuration, bool autoRewindWhenStopped, Map autoRewindDurations, bool autoTurnOnTimer, bool alwaysAutoTurnOnTimer, Duration autoTurnOnTime, Duration autoTurnOffTime) $default,) {final _that = this; +switch (_that) { +case _SleepTimerSettings(): +return $default(_that.defaultDuration,_that.presetDurations,_that.maxDuration,_that.fadeOutAudio,_that.fadeOutDuration,_that.autoRewindWhenStopped,_that.autoRewindDurations,_that.autoTurnOnTimer,_that.alwaysAutoTurnOnTimer,_that.autoTurnOnTime,_that.autoTurnOffTime);} +} +/// 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? Function( Duration defaultDuration, List presetDurations, Duration maxDuration, bool fadeOutAudio, Duration fadeOutDuration, bool autoRewindWhenStopped, Map autoRewindDurations, bool autoTurnOnTimer, bool alwaysAutoTurnOnTimer, Duration autoTurnOnTime, Duration autoTurnOffTime)? $default,) {final _that = this; +switch (_that) { +case _SleepTimerSettings() when $default != null: +return $default(_that.defaultDuration,_that.presetDurations,_that.maxDuration,_that.fadeOutAudio,_that.fadeOutDuration,_that.autoRewindWhenStopped,_that.autoRewindDurations,_that.autoTurnOnTimer,_that.alwaysAutoTurnOnTimer,_that.autoTurnOnTime,_that.autoTurnOffTime);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$SleepTimerSettingsImpl implements _SleepTimerSettings { - const _$SleepTimerSettingsImpl( - {this.defaultDuration = const Duration(minutes: 15), - final List presetDurations = const [ - Duration(minutes: 5), - Duration(minutes: 10), - Duration(minutes: 15), - Duration(minutes: 20), - Duration(minutes: 30) - ], - this.maxDuration = const Duration(minutes: 100), - this.fadeOutAudio = false, - this.fadeOutDuration = const Duration(seconds: 20), - this.autoRewindWhenStopped = false, - final Map autoRewindDurations = const { - 5: Duration(seconds: 10), - 15: Duration(seconds: 30), - 45: Duration(seconds: 45), - 60: Duration(minutes: 1), - 120: Duration(minutes: 2) - }, - this.autoTurnOnTimer = false, - this.alwaysAutoTurnOnTimer = false, - this.autoTurnOnTime = const Duration(hours: 22, minutes: 0), - this.autoTurnOffTime = const Duration(hours: 6, minutes: 0)}) - : _presetDurations = presetDurations, - _autoRewindDurations = autoRewindDurations; - factory _$SleepTimerSettingsImpl.fromJson(Map json) => - _$$SleepTimerSettingsImplFromJson(json); +class _SleepTimerSettings implements SleepTimerSettings { + const _SleepTimerSettings({this.defaultDuration = const Duration(minutes: 15), final List presetDurations = const [Duration(minutes: 5), Duration(minutes: 10), Duration(minutes: 15), Duration(minutes: 20), Duration(minutes: 30)], this.maxDuration = const Duration(minutes: 100), this.fadeOutAudio = false, this.fadeOutDuration = const Duration(seconds: 20), this.autoRewindWhenStopped = false, final Map autoRewindDurations = const {5 : Duration(seconds: 10), 15 : Duration(seconds: 30), 45 : Duration(seconds: 45), 60 : Duration(minutes: 1), 120 : Duration(minutes: 2)}, this.autoTurnOnTimer = false, this.alwaysAutoTurnOnTimer = false, this.autoTurnOnTime = const Duration(hours: 22, minutes: 0), this.autoTurnOffTime = const Duration(hours: 6, minutes: 0)}): _presetDurations = presetDurations,_autoRewindDurations = autoRewindDurations; + factory _SleepTimerSettings.fromJson(Map json) => _$SleepTimerSettingsFromJson(json); - @override - @JsonKey() - final Duration defaultDuration; - final List _presetDurations; - @override - @JsonKey() - List get presetDurations { - if (_presetDurations is EqualUnmodifiableListView) return _presetDurations; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_presetDurations); - } - - @override - @JsonKey() - final Duration maxDuration; - @override - @JsonKey() - final bool fadeOutAudio; - @override - @JsonKey() - final Duration fadeOutDuration; - - /// if true, the player will automatically rewind the audio when the sleep timer is stopped - @override - @JsonKey() - final bool autoRewindWhenStopped; - - /// the key is the duration in minutes - final Map _autoRewindDurations; - - /// the key is the duration in minutes - @override - @JsonKey() - Map get autoRewindDurations { - if (_autoRewindDurations is EqualUnmodifiableMapView) - return _autoRewindDurations; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_autoRewindDurations); - } - - /// auto turn on timer settings - @override - @JsonKey() - final bool autoTurnOnTimer; - - /// always auto turn on timer settings or during specific times - @override - @JsonKey() - final bool alwaysAutoTurnOnTimer; - - /// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false - /// - /// duration is the time from 00:00 - @override - @JsonKey() - final Duration autoTurnOnTime; - @override - @JsonKey() - final Duration autoTurnOffTime; - - @override - String toString() { - return 'SleepTimerSettings(defaultDuration: $defaultDuration, presetDurations: $presetDurations, maxDuration: $maxDuration, fadeOutAudio: $fadeOutAudio, fadeOutDuration: $fadeOutDuration, autoRewindWhenStopped: $autoRewindWhenStopped, autoRewindDurations: $autoRewindDurations, autoTurnOnTimer: $autoTurnOnTimer, alwaysAutoTurnOnTimer: $alwaysAutoTurnOnTimer, autoTurnOnTime: $autoTurnOnTime, autoTurnOffTime: $autoTurnOffTime)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$SleepTimerSettingsImpl && - (identical(other.defaultDuration, defaultDuration) || - other.defaultDuration == defaultDuration) && - const DeepCollectionEquality() - .equals(other._presetDurations, _presetDurations) && - (identical(other.maxDuration, maxDuration) || - other.maxDuration == maxDuration) && - (identical(other.fadeOutAudio, fadeOutAudio) || - other.fadeOutAudio == fadeOutAudio) && - (identical(other.fadeOutDuration, fadeOutDuration) || - other.fadeOutDuration == fadeOutDuration) && - (identical(other.autoRewindWhenStopped, autoRewindWhenStopped) || - other.autoRewindWhenStopped == autoRewindWhenStopped) && - const DeepCollectionEquality() - .equals(other._autoRewindDurations, _autoRewindDurations) && - (identical(other.autoTurnOnTimer, autoTurnOnTimer) || - other.autoTurnOnTimer == autoTurnOnTimer) && - (identical(other.alwaysAutoTurnOnTimer, alwaysAutoTurnOnTimer) || - other.alwaysAutoTurnOnTimer == alwaysAutoTurnOnTimer) && - (identical(other.autoTurnOnTime, autoTurnOnTime) || - other.autoTurnOnTime == autoTurnOnTime) && - (identical(other.autoTurnOffTime, autoTurnOffTime) || - other.autoTurnOffTime == autoTurnOffTime)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - defaultDuration, - const DeepCollectionEquality().hash(_presetDurations), - maxDuration, - fadeOutAudio, - fadeOutDuration, - autoRewindWhenStopped, - const DeepCollectionEquality().hash(_autoRewindDurations), - autoTurnOnTimer, - alwaysAutoTurnOnTimer, - autoTurnOnTime, - autoTurnOffTime); - - /// Create a copy of SleepTimerSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$SleepTimerSettingsImplCopyWith<_$SleepTimerSettingsImpl> get copyWith => - __$$SleepTimerSettingsImplCopyWithImpl<_$SleepTimerSettingsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$SleepTimerSettingsImplToJson( - this, - ); - } +@override@JsonKey() final Duration defaultDuration; + final List _presetDurations; +@override@JsonKey() List get presetDurations { + if (_presetDurations is EqualUnmodifiableListView) return _presetDurations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_presetDurations); } -abstract class _SleepTimerSettings implements SleepTimerSettings { - const factory _SleepTimerSettings( - {final Duration defaultDuration, - final List presetDurations, - final Duration maxDuration, - final bool fadeOutAudio, - final Duration fadeOutDuration, - final bool autoRewindWhenStopped, - final Map autoRewindDurations, - final bool autoTurnOnTimer, - final bool alwaysAutoTurnOnTimer, - final Duration autoTurnOnTime, - final Duration autoTurnOffTime}) = _$SleepTimerSettingsImpl; - - factory _SleepTimerSettings.fromJson(Map json) = - _$SleepTimerSettingsImpl.fromJson; - - @override - Duration get defaultDuration; - @override - List get presetDurations; - @override - Duration get maxDuration; - @override - bool get fadeOutAudio; - @override - Duration get fadeOutDuration; - - /// if true, the player will automatically rewind the audio when the sleep timer is stopped - @override - bool get autoRewindWhenStopped; - - /// the key is the duration in minutes - @override - Map get autoRewindDurations; - - /// auto turn on timer settings - @override - bool get autoTurnOnTimer; - - /// always auto turn on timer settings or during specific times - @override - bool get alwaysAutoTurnOnTimer; - - /// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false - /// - /// duration is the time from 00:00 - @override - Duration get autoTurnOnTime; - @override - Duration get autoTurnOffTime; - - /// Create a copy of SleepTimerSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$SleepTimerSettingsImplCopyWith<_$SleepTimerSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override@JsonKey() final Duration maxDuration; +@override@JsonKey() final bool fadeOutAudio; +@override@JsonKey() final Duration fadeOutDuration; +/// if true, the player will automatically rewind the audio when the sleep timer is stopped +@override@JsonKey() final bool autoRewindWhenStopped; +/// the key is the duration in minutes + final Map _autoRewindDurations; +/// the key is the duration in minutes +@override@JsonKey() Map get autoRewindDurations { + if (_autoRewindDurations is EqualUnmodifiableMapView) return _autoRewindDurations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_autoRewindDurations); } -DownloadSettings _$DownloadSettingsFromJson(Map json) { - return _DownloadSettings.fromJson(json); +/// auto turn on timer settings +@override@JsonKey() final bool autoTurnOnTimer; +/// always auto turn on timer settings or during specific times +@override@JsonKey() final bool alwaysAutoTurnOnTimer; +/// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false +/// +/// duration is the time from 00:00 +@override@JsonKey() final Duration autoTurnOnTime; +@override@JsonKey() final Duration autoTurnOffTime; + +/// Create a copy of SleepTimerSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SleepTimerSettingsCopyWith<_SleepTimerSettings> get copyWith => __$SleepTimerSettingsCopyWithImpl<_SleepTimerSettings>(this, _$identity); + +@override +Map toJson() { + return _$SleepTimerSettingsToJson(this, ); } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SleepTimerSettings&&(identical(other.defaultDuration, defaultDuration) || other.defaultDuration == defaultDuration)&&const DeepCollectionEquality().equals(other._presetDurations, _presetDurations)&&(identical(other.maxDuration, maxDuration) || other.maxDuration == maxDuration)&&(identical(other.fadeOutAudio, fadeOutAudio) || other.fadeOutAudio == fadeOutAudio)&&(identical(other.fadeOutDuration, fadeOutDuration) || other.fadeOutDuration == fadeOutDuration)&&(identical(other.autoRewindWhenStopped, autoRewindWhenStopped) || other.autoRewindWhenStopped == autoRewindWhenStopped)&&const DeepCollectionEquality().equals(other._autoRewindDurations, _autoRewindDurations)&&(identical(other.autoTurnOnTimer, autoTurnOnTimer) || other.autoTurnOnTimer == autoTurnOnTimer)&&(identical(other.alwaysAutoTurnOnTimer, alwaysAutoTurnOnTimer) || other.alwaysAutoTurnOnTimer == alwaysAutoTurnOnTimer)&&(identical(other.autoTurnOnTime, autoTurnOnTime) || other.autoTurnOnTime == autoTurnOnTime)&&(identical(other.autoTurnOffTime, autoTurnOffTime) || other.autoTurnOffTime == autoTurnOffTime)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,defaultDuration,const DeepCollectionEquality().hash(_presetDurations),maxDuration,fadeOutAudio,fadeOutDuration,autoRewindWhenStopped,const DeepCollectionEquality().hash(_autoRewindDurations),autoTurnOnTimer,alwaysAutoTurnOnTimer,autoTurnOnTime,autoTurnOffTime); + +@override +String toString() { + return 'SleepTimerSettings(defaultDuration: $defaultDuration, presetDurations: $presetDurations, maxDuration: $maxDuration, fadeOutAudio: $fadeOutAudio, fadeOutDuration: $fadeOutDuration, autoRewindWhenStopped: $autoRewindWhenStopped, autoRewindDurations: $autoRewindDurations, autoTurnOnTimer: $autoTurnOnTimer, alwaysAutoTurnOnTimer: $alwaysAutoTurnOnTimer, autoTurnOnTime: $autoTurnOnTime, autoTurnOffTime: $autoTurnOffTime)'; +} + + +} + +/// @nodoc +abstract mixin class _$SleepTimerSettingsCopyWith<$Res> implements $SleepTimerSettingsCopyWith<$Res> { + factory _$SleepTimerSettingsCopyWith(_SleepTimerSettings value, $Res Function(_SleepTimerSettings) _then) = __$SleepTimerSettingsCopyWithImpl; +@override @useResult +$Res call({ + Duration defaultDuration, List presetDurations, Duration maxDuration, bool fadeOutAudio, Duration fadeOutDuration, bool autoRewindWhenStopped, Map autoRewindDurations, bool autoTurnOnTimer, bool alwaysAutoTurnOnTimer, Duration autoTurnOnTime, Duration autoTurnOffTime +}); + + + + +} +/// @nodoc +class __$SleepTimerSettingsCopyWithImpl<$Res> + implements _$SleepTimerSettingsCopyWith<$Res> { + __$SleepTimerSettingsCopyWithImpl(this._self, this._then); + + final _SleepTimerSettings _self; + final $Res Function(_SleepTimerSettings) _then; + +/// Create a copy of SleepTimerSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? defaultDuration = null,Object? presetDurations = null,Object? maxDuration = null,Object? fadeOutAudio = null,Object? fadeOutDuration = null,Object? autoRewindWhenStopped = null,Object? autoRewindDurations = null,Object? autoTurnOnTimer = null,Object? alwaysAutoTurnOnTimer = null,Object? autoTurnOnTime = null,Object? autoTurnOffTime = null,}) { + return _then(_SleepTimerSettings( +defaultDuration: null == defaultDuration ? _self.defaultDuration : defaultDuration // ignore: cast_nullable_to_non_nullable +as Duration,presetDurations: null == presetDurations ? _self._presetDurations : presetDurations // ignore: cast_nullable_to_non_nullable +as List,maxDuration: null == maxDuration ? _self.maxDuration : maxDuration // ignore: cast_nullable_to_non_nullable +as Duration,fadeOutAudio: null == fadeOutAudio ? _self.fadeOutAudio : fadeOutAudio // ignore: cast_nullable_to_non_nullable +as bool,fadeOutDuration: null == fadeOutDuration ? _self.fadeOutDuration : fadeOutDuration // ignore: cast_nullable_to_non_nullable +as Duration,autoRewindWhenStopped: null == autoRewindWhenStopped ? _self.autoRewindWhenStopped : autoRewindWhenStopped // ignore: cast_nullable_to_non_nullable +as bool,autoRewindDurations: null == autoRewindDurations ? _self._autoRewindDurations : autoRewindDurations // ignore: cast_nullable_to_non_nullable +as Map,autoTurnOnTimer: null == autoTurnOnTimer ? _self.autoTurnOnTimer : autoTurnOnTimer // ignore: cast_nullable_to_non_nullable +as bool,alwaysAutoTurnOnTimer: null == alwaysAutoTurnOnTimer ? _self.alwaysAutoTurnOnTimer : alwaysAutoTurnOnTimer // ignore: cast_nullable_to_non_nullable +as bool,autoTurnOnTime: null == autoTurnOnTime ? _self.autoTurnOnTime : autoTurnOnTime // ignore: cast_nullable_to_non_nullable +as Duration,autoTurnOffTime: null == autoTurnOffTime ? _self.autoTurnOffTime : autoTurnOffTime // ignore: cast_nullable_to_non_nullable +as Duration, + )); +} + + +} + + /// @nodoc mixin _$DownloadSettings { - bool get requiresWiFi => throw _privateConstructorUsedError; - int get retries => throw _privateConstructorUsedError; - bool get allowPause => throw _privateConstructorUsedError; - int get maxConcurrent => throw _privateConstructorUsedError; - int get maxConcurrentByHost => throw _privateConstructorUsedError; - int get maxConcurrentByGroup => throw _privateConstructorUsedError; + + bool get requiresWiFi; int get retries; bool get allowPause; int get maxConcurrent; int get maxConcurrentByHost; int get maxConcurrentByGroup; +/// Create a copy of DownloadSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DownloadSettingsCopyWith get copyWith => _$DownloadSettingsCopyWithImpl(this as DownloadSettings, _$identity); /// Serializes this DownloadSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DownloadSettings&&(identical(other.requiresWiFi, requiresWiFi) || other.requiresWiFi == requiresWiFi)&&(identical(other.retries, retries) || other.retries == retries)&&(identical(other.allowPause, allowPause) || other.allowPause == allowPause)&&(identical(other.maxConcurrent, maxConcurrent) || other.maxConcurrent == maxConcurrent)&&(identical(other.maxConcurrentByHost, maxConcurrentByHost) || other.maxConcurrentByHost == maxConcurrentByHost)&&(identical(other.maxConcurrentByGroup, maxConcurrentByGroup) || other.maxConcurrentByGroup == maxConcurrentByGroup)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,requiresWiFi,retries,allowPause,maxConcurrent,maxConcurrentByHost,maxConcurrentByGroup); + +@override +String toString() { + return 'DownloadSettings(requiresWiFi: $requiresWiFi, retries: $retries, allowPause: $allowPause, maxConcurrent: $maxConcurrent, maxConcurrentByHost: $maxConcurrentByHost, maxConcurrentByGroup: $maxConcurrentByGroup)'; +} + - /// Create a copy of DownloadSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $DownloadSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $DownloadSettingsCopyWith<$Res> { - factory $DownloadSettingsCopyWith( - DownloadSettings value, $Res Function(DownloadSettings) then) = - _$DownloadSettingsCopyWithImpl<$Res, DownloadSettings>; - @useResult - $Res call( - {bool requiresWiFi, - int retries, - bool allowPause, - int maxConcurrent, - int maxConcurrentByHost, - int maxConcurrentByGroup}); -} +abstract mixin class $DownloadSettingsCopyWith<$Res> { + factory $DownloadSettingsCopyWith(DownloadSettings value, $Res Function(DownloadSettings) _then) = _$DownloadSettingsCopyWithImpl; +@useResult +$Res call({ + bool requiresWiFi, int retries, bool allowPause, int maxConcurrent, int maxConcurrentByHost, int maxConcurrentByGroup +}); + + + +} /// @nodoc -class _$DownloadSettingsCopyWithImpl<$Res, $Val extends DownloadSettings> +class _$DownloadSettingsCopyWithImpl<$Res> implements $DownloadSettingsCopyWith<$Res> { - _$DownloadSettingsCopyWithImpl(this._value, this._then); + _$DownloadSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final DownloadSettings _self; + final $Res Function(DownloadSettings) _then; - /// Create a copy of DownloadSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? requiresWiFi = null, - Object? retries = null, - Object? allowPause = null, - Object? maxConcurrent = null, - Object? maxConcurrentByHost = null, - Object? maxConcurrentByGroup = null, - }) { - return _then(_value.copyWith( - requiresWiFi: null == requiresWiFi - ? _value.requiresWiFi - : requiresWiFi // ignore: cast_nullable_to_non_nullable - as bool, - retries: null == retries - ? _value.retries - : retries // ignore: cast_nullable_to_non_nullable - as int, - allowPause: null == allowPause - ? _value.allowPause - : allowPause // ignore: cast_nullable_to_non_nullable - as bool, - maxConcurrent: null == maxConcurrent - ? _value.maxConcurrent - : maxConcurrent // ignore: cast_nullable_to_non_nullable - as int, - maxConcurrentByHost: null == maxConcurrentByHost - ? _value.maxConcurrentByHost - : maxConcurrentByHost // ignore: cast_nullable_to_non_nullable - as int, - maxConcurrentByGroup: null == maxConcurrentByGroup - ? _value.maxConcurrentByGroup - : maxConcurrentByGroup // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } +/// Create a copy of DownloadSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? requiresWiFi = null,Object? retries = null,Object? allowPause = null,Object? maxConcurrent = null,Object? maxConcurrentByHost = null,Object? maxConcurrentByGroup = null,}) { + return _then(_self.copyWith( +requiresWiFi: null == requiresWiFi ? _self.requiresWiFi : requiresWiFi // ignore: cast_nullable_to_non_nullable +as bool,retries: null == retries ? _self.retries : retries // ignore: cast_nullable_to_non_nullable +as int,allowPause: null == allowPause ? _self.allowPause : allowPause // ignore: cast_nullable_to_non_nullable +as bool,maxConcurrent: null == maxConcurrent ? _self.maxConcurrent : maxConcurrent // ignore: cast_nullable_to_non_nullable +as int,maxConcurrentByHost: null == maxConcurrentByHost ? _self.maxConcurrentByHost : maxConcurrentByHost // ignore: cast_nullable_to_non_nullable +as int,maxConcurrentByGroup: null == maxConcurrentByGroup ? _self.maxConcurrentByGroup : maxConcurrentByGroup // ignore: cast_nullable_to_non_nullable +as int, + )); } -/// @nodoc -abstract class _$$DownloadSettingsImplCopyWith<$Res> - implements $DownloadSettingsCopyWith<$Res> { - factory _$$DownloadSettingsImplCopyWith(_$DownloadSettingsImpl value, - $Res Function(_$DownloadSettingsImpl) then) = - __$$DownloadSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {bool requiresWiFi, - int retries, - bool allowPause, - int maxConcurrent, - int maxConcurrentByHost, - int maxConcurrentByGroup}); } -/// @nodoc -class __$$DownloadSettingsImplCopyWithImpl<$Res> - extends _$DownloadSettingsCopyWithImpl<$Res, _$DownloadSettingsImpl> - implements _$$DownloadSettingsImplCopyWith<$Res> { - __$$DownloadSettingsImplCopyWithImpl(_$DownloadSettingsImpl _value, - $Res Function(_$DownloadSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of DownloadSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? requiresWiFi = null, - Object? retries = null, - Object? allowPause = null, - Object? maxConcurrent = null, - Object? maxConcurrentByHost = null, - Object? maxConcurrentByGroup = null, - }) { - return _then(_$DownloadSettingsImpl( - requiresWiFi: null == requiresWiFi - ? _value.requiresWiFi - : requiresWiFi // ignore: cast_nullable_to_non_nullable - as bool, - retries: null == retries - ? _value.retries - : retries // ignore: cast_nullable_to_non_nullable - as int, - allowPause: null == allowPause - ? _value.allowPause - : allowPause // ignore: cast_nullable_to_non_nullable - as bool, - maxConcurrent: null == maxConcurrent - ? _value.maxConcurrent - : maxConcurrent // ignore: cast_nullable_to_non_nullable - as int, - maxConcurrentByHost: null == maxConcurrentByHost - ? _value.maxConcurrentByHost - : maxConcurrentByHost // ignore: cast_nullable_to_non_nullable - as int, - maxConcurrentByGroup: null == maxConcurrentByGroup - ? _value.maxConcurrentByGroup - : maxConcurrentByGroup // ignore: cast_nullable_to_non_nullable - as int, - )); - } +/// Adds pattern-matching-related methods to [DownloadSettings]. +extension DownloadSettingsPatterns on DownloadSettings { +/// 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 Function( _DownloadSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DownloadSettings() 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 Function( _DownloadSettings value) $default,){ +final _that = this; +switch (_that) { +case _DownloadSettings(): +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? Function( _DownloadSettings value)? $default,){ +final _that = this; +switch (_that) { +case _DownloadSettings() 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 Function( bool requiresWiFi, int retries, bool allowPause, int maxConcurrent, int maxConcurrentByHost, int maxConcurrentByGroup)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DownloadSettings() when $default != null: +return $default(_that.requiresWiFi,_that.retries,_that.allowPause,_that.maxConcurrent,_that.maxConcurrentByHost,_that.maxConcurrentByGroup);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 Function( bool requiresWiFi, int retries, bool allowPause, int maxConcurrent, int maxConcurrentByHost, int maxConcurrentByGroup) $default,) {final _that = this; +switch (_that) { +case _DownloadSettings(): +return $default(_that.requiresWiFi,_that.retries,_that.allowPause,_that.maxConcurrent,_that.maxConcurrentByHost,_that.maxConcurrentByGroup);} +} +/// 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? Function( bool requiresWiFi, int retries, bool allowPause, int maxConcurrent, int maxConcurrentByHost, int maxConcurrentByGroup)? $default,) {final _that = this; +switch (_that) { +case _DownloadSettings() when $default != null: +return $default(_that.requiresWiFi,_that.retries,_that.allowPause,_that.maxConcurrent,_that.maxConcurrentByHost,_that.maxConcurrentByGroup);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$DownloadSettingsImpl implements _DownloadSettings { - const _$DownloadSettingsImpl( - {this.requiresWiFi = true, - this.retries = 3, - this.allowPause = true, - this.maxConcurrent = 3, - this.maxConcurrentByHost = 3, - this.maxConcurrentByGroup = 3}); - factory _$DownloadSettingsImpl.fromJson(Map json) => - _$$DownloadSettingsImplFromJson(json); +class _DownloadSettings implements DownloadSettings { + const _DownloadSettings({this.requiresWiFi = true, this.retries = 3, this.allowPause = true, this.maxConcurrent = 3, this.maxConcurrentByHost = 3, this.maxConcurrentByGroup = 3}); + factory _DownloadSettings.fromJson(Map json) => _$DownloadSettingsFromJson(json); - @override - @JsonKey() - final bool requiresWiFi; - @override - @JsonKey() - final int retries; - @override - @JsonKey() - final bool allowPause; - @override - @JsonKey() - final int maxConcurrent; - @override - @JsonKey() - final int maxConcurrentByHost; - @override - @JsonKey() - final int maxConcurrentByGroup; +@override@JsonKey() final bool requiresWiFi; +@override@JsonKey() final int retries; +@override@JsonKey() final bool allowPause; +@override@JsonKey() final int maxConcurrent; +@override@JsonKey() final int maxConcurrentByHost; +@override@JsonKey() final int maxConcurrentByGroup; - @override - String toString() { - return 'DownloadSettings(requiresWiFi: $requiresWiFi, retries: $retries, allowPause: $allowPause, maxConcurrent: $maxConcurrent, maxConcurrentByHost: $maxConcurrentByHost, maxConcurrentByGroup: $maxConcurrentByGroup)'; - } +/// Create a copy of DownloadSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DownloadSettingsCopyWith<_DownloadSettings> get copyWith => __$DownloadSettingsCopyWithImpl<_DownloadSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DownloadSettingsImpl && - (identical(other.requiresWiFi, requiresWiFi) || - other.requiresWiFi == requiresWiFi) && - (identical(other.retries, retries) || other.retries == retries) && - (identical(other.allowPause, allowPause) || - other.allowPause == allowPause) && - (identical(other.maxConcurrent, maxConcurrent) || - other.maxConcurrent == maxConcurrent) && - (identical(other.maxConcurrentByHost, maxConcurrentByHost) || - other.maxConcurrentByHost == maxConcurrentByHost) && - (identical(other.maxConcurrentByGroup, maxConcurrentByGroup) || - other.maxConcurrentByGroup == maxConcurrentByGroup)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, requiresWiFi, retries, - allowPause, maxConcurrent, maxConcurrentByHost, maxConcurrentByGroup); - - /// Create a copy of DownloadSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$DownloadSettingsImplCopyWith<_$DownloadSettingsImpl> get copyWith => - __$$DownloadSettingsImplCopyWithImpl<_$DownloadSettingsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$DownloadSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$DownloadSettingsToJson(this, ); } -abstract class _DownloadSettings implements DownloadSettings { - const factory _DownloadSettings( - {final bool requiresWiFi, - final int retries, - final bool allowPause, - final int maxConcurrent, - final int maxConcurrentByHost, - final int maxConcurrentByGroup}) = _$DownloadSettingsImpl; - - factory _DownloadSettings.fromJson(Map json) = - _$DownloadSettingsImpl.fromJson; - - @override - bool get requiresWiFi; - @override - int get retries; - @override - bool get allowPause; - @override - int get maxConcurrent; - @override - int get maxConcurrentByHost; - @override - int get maxConcurrentByGroup; - - /// Create a copy of DownloadSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$DownloadSettingsImplCopyWith<_$DownloadSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DownloadSettings&&(identical(other.requiresWiFi, requiresWiFi) || other.requiresWiFi == requiresWiFi)&&(identical(other.retries, retries) || other.retries == retries)&&(identical(other.allowPause, allowPause) || other.allowPause == allowPause)&&(identical(other.maxConcurrent, maxConcurrent) || other.maxConcurrent == maxConcurrent)&&(identical(other.maxConcurrentByHost, maxConcurrentByHost) || other.maxConcurrentByHost == maxConcurrentByHost)&&(identical(other.maxConcurrentByGroup, maxConcurrentByGroup) || other.maxConcurrentByGroup == maxConcurrentByGroup)); } -NotificationSettings _$NotificationSettingsFromJson(Map json) { - return _NotificationSettings.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,requiresWiFi,retries,allowPause,maxConcurrent,maxConcurrentByHost,maxConcurrentByGroup); + +@override +String toString() { + return 'DownloadSettings(requiresWiFi: $requiresWiFi, retries: $retries, allowPause: $allowPause, maxConcurrent: $maxConcurrent, maxConcurrentByHost: $maxConcurrentByHost, maxConcurrentByGroup: $maxConcurrentByGroup)'; } + +} + +/// @nodoc +abstract mixin class _$DownloadSettingsCopyWith<$Res> implements $DownloadSettingsCopyWith<$Res> { + factory _$DownloadSettingsCopyWith(_DownloadSettings value, $Res Function(_DownloadSettings) _then) = __$DownloadSettingsCopyWithImpl; +@override @useResult +$Res call({ + bool requiresWiFi, int retries, bool allowPause, int maxConcurrent, int maxConcurrentByHost, int maxConcurrentByGroup +}); + + + + +} +/// @nodoc +class __$DownloadSettingsCopyWithImpl<$Res> + implements _$DownloadSettingsCopyWith<$Res> { + __$DownloadSettingsCopyWithImpl(this._self, this._then); + + final _DownloadSettings _self; + final $Res Function(_DownloadSettings) _then; + +/// Create a copy of DownloadSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? requiresWiFi = null,Object? retries = null,Object? allowPause = null,Object? maxConcurrent = null,Object? maxConcurrentByHost = null,Object? maxConcurrentByGroup = null,}) { + return _then(_DownloadSettings( +requiresWiFi: null == requiresWiFi ? _self.requiresWiFi : requiresWiFi // ignore: cast_nullable_to_non_nullable +as bool,retries: null == retries ? _self.retries : retries // ignore: cast_nullable_to_non_nullable +as int,allowPause: null == allowPause ? _self.allowPause : allowPause // ignore: cast_nullable_to_non_nullable +as bool,maxConcurrent: null == maxConcurrent ? _self.maxConcurrent : maxConcurrent // ignore: cast_nullable_to_non_nullable +as int,maxConcurrentByHost: null == maxConcurrentByHost ? _self.maxConcurrentByHost : maxConcurrentByHost // ignore: cast_nullable_to_non_nullable +as int,maxConcurrentByGroup: null == maxConcurrentByGroup ? _self.maxConcurrentByGroup : maxConcurrentByGroup // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + + /// @nodoc mixin _$NotificationSettings { - Duration get fastForwardInterval => throw _privateConstructorUsedError; - Duration get rewindInterval => throw _privateConstructorUsedError; - bool get progressBarIsChapterProgress => throw _privateConstructorUsedError; - String get primaryTitle => throw _privateConstructorUsedError; - String get secondaryTitle => throw _privateConstructorUsedError; - List get mediaControls => - throw _privateConstructorUsedError; + + Duration get fastForwardInterval; Duration get rewindInterval; bool get progressBarIsChapterProgress; String get primaryTitle; String get secondaryTitle; List get mediaControls; +/// Create a copy of NotificationSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$NotificationSettingsCopyWith get copyWith => _$NotificationSettingsCopyWithImpl(this as NotificationSettings, _$identity); /// Serializes this NotificationSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is NotificationSettings&&(identical(other.fastForwardInterval, fastForwardInterval) || other.fastForwardInterval == fastForwardInterval)&&(identical(other.rewindInterval, rewindInterval) || other.rewindInterval == rewindInterval)&&(identical(other.progressBarIsChapterProgress, progressBarIsChapterProgress) || other.progressBarIsChapterProgress == progressBarIsChapterProgress)&&(identical(other.primaryTitle, primaryTitle) || other.primaryTitle == primaryTitle)&&(identical(other.secondaryTitle, secondaryTitle) || other.secondaryTitle == secondaryTitle)&&const DeepCollectionEquality().equals(other.mediaControls, mediaControls)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,fastForwardInterval,rewindInterval,progressBarIsChapterProgress,primaryTitle,secondaryTitle,const DeepCollectionEquality().hash(mediaControls)); + +@override +String toString() { + return 'NotificationSettings(fastForwardInterval: $fastForwardInterval, rewindInterval: $rewindInterval, progressBarIsChapterProgress: $progressBarIsChapterProgress, primaryTitle: $primaryTitle, secondaryTitle: $secondaryTitle, mediaControls: $mediaControls)'; +} + - /// Create a copy of NotificationSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $NotificationSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $NotificationSettingsCopyWith<$Res> { - factory $NotificationSettingsCopyWith(NotificationSettings value, - $Res Function(NotificationSettings) then) = - _$NotificationSettingsCopyWithImpl<$Res, NotificationSettings>; - @useResult - $Res call( - {Duration fastForwardInterval, - Duration rewindInterval, - bool progressBarIsChapterProgress, - String primaryTitle, - String secondaryTitle, - List mediaControls}); -} +abstract mixin class $NotificationSettingsCopyWith<$Res> { + factory $NotificationSettingsCopyWith(NotificationSettings value, $Res Function(NotificationSettings) _then) = _$NotificationSettingsCopyWithImpl; +@useResult +$Res call({ + Duration fastForwardInterval, Duration rewindInterval, bool progressBarIsChapterProgress, String primaryTitle, String secondaryTitle, List mediaControls +}); + + + +} /// @nodoc -class _$NotificationSettingsCopyWithImpl<$Res, - $Val extends NotificationSettings> +class _$NotificationSettingsCopyWithImpl<$Res> implements $NotificationSettingsCopyWith<$Res> { - _$NotificationSettingsCopyWithImpl(this._value, this._then); + _$NotificationSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final NotificationSettings _self; + final $Res Function(NotificationSettings) _then; - /// Create a copy of NotificationSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? fastForwardInterval = null, - Object? rewindInterval = null, - Object? progressBarIsChapterProgress = null, - Object? primaryTitle = null, - Object? secondaryTitle = null, - Object? mediaControls = null, - }) { - return _then(_value.copyWith( - fastForwardInterval: null == fastForwardInterval - ? _value.fastForwardInterval - : fastForwardInterval // ignore: cast_nullable_to_non_nullable - as Duration, - rewindInterval: null == rewindInterval - ? _value.rewindInterval - : rewindInterval // ignore: cast_nullable_to_non_nullable - as Duration, - progressBarIsChapterProgress: null == progressBarIsChapterProgress - ? _value.progressBarIsChapterProgress - : progressBarIsChapterProgress // ignore: cast_nullable_to_non_nullable - as bool, - primaryTitle: null == primaryTitle - ? _value.primaryTitle - : primaryTitle // ignore: cast_nullable_to_non_nullable - as String, - secondaryTitle: null == secondaryTitle - ? _value.secondaryTitle - : secondaryTitle // ignore: cast_nullable_to_non_nullable - as String, - mediaControls: null == mediaControls - ? _value.mediaControls - : mediaControls // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } +/// Create a copy of NotificationSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? fastForwardInterval = null,Object? rewindInterval = null,Object? progressBarIsChapterProgress = null,Object? primaryTitle = null,Object? secondaryTitle = null,Object? mediaControls = null,}) { + return _then(_self.copyWith( +fastForwardInterval: null == fastForwardInterval ? _self.fastForwardInterval : fastForwardInterval // ignore: cast_nullable_to_non_nullable +as Duration,rewindInterval: null == rewindInterval ? _self.rewindInterval : rewindInterval // ignore: cast_nullable_to_non_nullable +as Duration,progressBarIsChapterProgress: null == progressBarIsChapterProgress ? _self.progressBarIsChapterProgress : progressBarIsChapterProgress // ignore: cast_nullable_to_non_nullable +as bool,primaryTitle: null == primaryTitle ? _self.primaryTitle : primaryTitle // ignore: cast_nullable_to_non_nullable +as String,secondaryTitle: null == secondaryTitle ? _self.secondaryTitle : secondaryTitle // ignore: cast_nullable_to_non_nullable +as String,mediaControls: null == mediaControls ? _self.mediaControls : mediaControls // ignore: cast_nullable_to_non_nullable +as List, + )); } -/// @nodoc -abstract class _$$NotificationSettingsImplCopyWith<$Res> - implements $NotificationSettingsCopyWith<$Res> { - factory _$$NotificationSettingsImplCopyWith(_$NotificationSettingsImpl value, - $Res Function(_$NotificationSettingsImpl) then) = - __$$NotificationSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {Duration fastForwardInterval, - Duration rewindInterval, - bool progressBarIsChapterProgress, - String primaryTitle, - String secondaryTitle, - List mediaControls}); } -/// @nodoc -class __$$NotificationSettingsImplCopyWithImpl<$Res> - extends _$NotificationSettingsCopyWithImpl<$Res, _$NotificationSettingsImpl> - implements _$$NotificationSettingsImplCopyWith<$Res> { - __$$NotificationSettingsImplCopyWithImpl(_$NotificationSettingsImpl _value, - $Res Function(_$NotificationSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of NotificationSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? fastForwardInterval = null, - Object? rewindInterval = null, - Object? progressBarIsChapterProgress = null, - Object? primaryTitle = null, - Object? secondaryTitle = null, - Object? mediaControls = null, - }) { - return _then(_$NotificationSettingsImpl( - fastForwardInterval: null == fastForwardInterval - ? _value.fastForwardInterval - : fastForwardInterval // ignore: cast_nullable_to_non_nullable - as Duration, - rewindInterval: null == rewindInterval - ? _value.rewindInterval - : rewindInterval // ignore: cast_nullable_to_non_nullable - as Duration, - progressBarIsChapterProgress: null == progressBarIsChapterProgress - ? _value.progressBarIsChapterProgress - : progressBarIsChapterProgress // ignore: cast_nullable_to_non_nullable - as bool, - primaryTitle: null == primaryTitle - ? _value.primaryTitle - : primaryTitle // ignore: cast_nullable_to_non_nullable - as String, - secondaryTitle: null == secondaryTitle - ? _value.secondaryTitle - : secondaryTitle // ignore: cast_nullable_to_non_nullable - as String, - mediaControls: null == mediaControls - ? _value._mediaControls - : mediaControls // ignore: cast_nullable_to_non_nullable - as List, - )); - } +/// Adds pattern-matching-related methods to [NotificationSettings]. +extension NotificationSettingsPatterns on NotificationSettings { +/// 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 Function( _NotificationSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _NotificationSettings() 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 Function( _NotificationSettings value) $default,){ +final _that = this; +switch (_that) { +case _NotificationSettings(): +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? Function( _NotificationSettings value)? $default,){ +final _that = this; +switch (_that) { +case _NotificationSettings() 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 Function( Duration fastForwardInterval, Duration rewindInterval, bool progressBarIsChapterProgress, String primaryTitle, String secondaryTitle, List mediaControls)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _NotificationSettings() when $default != null: +return $default(_that.fastForwardInterval,_that.rewindInterval,_that.progressBarIsChapterProgress,_that.primaryTitle,_that.secondaryTitle,_that.mediaControls);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 Function( Duration fastForwardInterval, Duration rewindInterval, bool progressBarIsChapterProgress, String primaryTitle, String secondaryTitle, List mediaControls) $default,) {final _that = this; +switch (_that) { +case _NotificationSettings(): +return $default(_that.fastForwardInterval,_that.rewindInterval,_that.progressBarIsChapterProgress,_that.primaryTitle,_that.secondaryTitle,_that.mediaControls);} +} +/// 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? Function( Duration fastForwardInterval, Duration rewindInterval, bool progressBarIsChapterProgress, String primaryTitle, String secondaryTitle, List mediaControls)? $default,) {final _that = this; +switch (_that) { +case _NotificationSettings() when $default != null: +return $default(_that.fastForwardInterval,_that.rewindInterval,_that.progressBarIsChapterProgress,_that.primaryTitle,_that.secondaryTitle,_that.mediaControls);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$NotificationSettingsImpl implements _NotificationSettings { - const _$NotificationSettingsImpl( - {this.fastForwardInterval = const Duration(seconds: 30), - this.rewindInterval = const Duration(seconds: 10), - this.progressBarIsChapterProgress = true, - this.primaryTitle = '\$bookTitle', - this.secondaryTitle = '\$author', - final List mediaControls = const [ - NotificationMediaControl.rewind, - NotificationMediaControl.fastForward, - NotificationMediaControl.skipToPreviousChapter, - NotificationMediaControl.skipToNextChapter - ]}) - : _mediaControls = mediaControls; - factory _$NotificationSettingsImpl.fromJson(Map json) => - _$$NotificationSettingsImplFromJson(json); +class _NotificationSettings implements NotificationSettings { + const _NotificationSettings({this.fastForwardInterval = const Duration(seconds: 30), this.rewindInterval = const Duration(seconds: 10), this.progressBarIsChapterProgress = true, this.primaryTitle = '\$bookTitle', this.secondaryTitle = '\$author', final List mediaControls = const [NotificationMediaControl.rewind, NotificationMediaControl.fastForward, NotificationMediaControl.skipToPreviousChapter, NotificationMediaControl.skipToNextChapter]}): _mediaControls = mediaControls; + factory _NotificationSettings.fromJson(Map json) => _$NotificationSettingsFromJson(json); - @override - @JsonKey() - final Duration fastForwardInterval; - @override - @JsonKey() - final Duration rewindInterval; - @override - @JsonKey() - final bool progressBarIsChapterProgress; - @override - @JsonKey() - final String primaryTitle; - @override - @JsonKey() - final String secondaryTitle; - final List _mediaControls; - @override - @JsonKey() - List get mediaControls { - if (_mediaControls is EqualUnmodifiableListView) return _mediaControls; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_mediaControls); - } - - @override - String toString() { - return 'NotificationSettings(fastForwardInterval: $fastForwardInterval, rewindInterval: $rewindInterval, progressBarIsChapterProgress: $progressBarIsChapterProgress, primaryTitle: $primaryTitle, secondaryTitle: $secondaryTitle, mediaControls: $mediaControls)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NotificationSettingsImpl && - (identical(other.fastForwardInterval, fastForwardInterval) || - other.fastForwardInterval == fastForwardInterval) && - (identical(other.rewindInterval, rewindInterval) || - other.rewindInterval == rewindInterval) && - (identical(other.progressBarIsChapterProgress, - progressBarIsChapterProgress) || - other.progressBarIsChapterProgress == - progressBarIsChapterProgress) && - (identical(other.primaryTitle, primaryTitle) || - other.primaryTitle == primaryTitle) && - (identical(other.secondaryTitle, secondaryTitle) || - other.secondaryTitle == secondaryTitle) && - const DeepCollectionEquality() - .equals(other._mediaControls, _mediaControls)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - fastForwardInterval, - rewindInterval, - progressBarIsChapterProgress, - primaryTitle, - secondaryTitle, - const DeepCollectionEquality().hash(_mediaControls)); - - /// Create a copy of NotificationSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$NotificationSettingsImplCopyWith<_$NotificationSettingsImpl> - get copyWith => - __$$NotificationSettingsImplCopyWithImpl<_$NotificationSettingsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$NotificationSettingsImplToJson( - this, - ); - } +@override@JsonKey() final Duration fastForwardInterval; +@override@JsonKey() final Duration rewindInterval; +@override@JsonKey() final bool progressBarIsChapterProgress; +@override@JsonKey() final String primaryTitle; +@override@JsonKey() final String secondaryTitle; + final List _mediaControls; +@override@JsonKey() List get mediaControls { + if (_mediaControls is EqualUnmodifiableListView) return _mediaControls; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_mediaControls); } -abstract class _NotificationSettings implements NotificationSettings { - const factory _NotificationSettings( - {final Duration fastForwardInterval, - final Duration rewindInterval, - final bool progressBarIsChapterProgress, - final String primaryTitle, - final String secondaryTitle, - final List mediaControls}) = - _$NotificationSettingsImpl; - factory _NotificationSettings.fromJson(Map json) = - _$NotificationSettingsImpl.fromJson; +/// Create a copy of NotificationSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$NotificationSettingsCopyWith<_NotificationSettings> get copyWith => __$NotificationSettingsCopyWithImpl<_NotificationSettings>(this, _$identity); - @override - Duration get fastForwardInterval; - @override - Duration get rewindInterval; - @override - bool get progressBarIsChapterProgress; - @override - String get primaryTitle; - @override - String get secondaryTitle; - @override - List get mediaControls; - - /// Create a copy of NotificationSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$NotificationSettingsImplCopyWith<_$NotificationSettingsImpl> - get copyWith => throw _privateConstructorUsedError; +@override +Map toJson() { + return _$NotificationSettingsToJson(this, ); } -ShakeDetectionSettings _$ShakeDetectionSettingsFromJson( - Map json) { - return _ShakeDetectionSettings.fromJson(json); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _NotificationSettings&&(identical(other.fastForwardInterval, fastForwardInterval) || other.fastForwardInterval == fastForwardInterval)&&(identical(other.rewindInterval, rewindInterval) || other.rewindInterval == rewindInterval)&&(identical(other.progressBarIsChapterProgress, progressBarIsChapterProgress) || other.progressBarIsChapterProgress == progressBarIsChapterProgress)&&(identical(other.primaryTitle, primaryTitle) || other.primaryTitle == primaryTitle)&&(identical(other.secondaryTitle, secondaryTitle) || other.secondaryTitle == secondaryTitle)&&const DeepCollectionEquality().equals(other._mediaControls, _mediaControls)); } +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,fastForwardInterval,rewindInterval,progressBarIsChapterProgress,primaryTitle,secondaryTitle,const DeepCollectionEquality().hash(_mediaControls)); + +@override +String toString() { + return 'NotificationSettings(fastForwardInterval: $fastForwardInterval, rewindInterval: $rewindInterval, progressBarIsChapterProgress: $progressBarIsChapterProgress, primaryTitle: $primaryTitle, secondaryTitle: $secondaryTitle, mediaControls: $mediaControls)'; +} + + +} + +/// @nodoc +abstract mixin class _$NotificationSettingsCopyWith<$Res> implements $NotificationSettingsCopyWith<$Res> { + factory _$NotificationSettingsCopyWith(_NotificationSettings value, $Res Function(_NotificationSettings) _then) = __$NotificationSettingsCopyWithImpl; +@override @useResult +$Res call({ + Duration fastForwardInterval, Duration rewindInterval, bool progressBarIsChapterProgress, String primaryTitle, String secondaryTitle, List mediaControls +}); + + + + +} +/// @nodoc +class __$NotificationSettingsCopyWithImpl<$Res> + implements _$NotificationSettingsCopyWith<$Res> { + __$NotificationSettingsCopyWithImpl(this._self, this._then); + + final _NotificationSettings _self; + final $Res Function(_NotificationSettings) _then; + +/// Create a copy of NotificationSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? fastForwardInterval = null,Object? rewindInterval = null,Object? progressBarIsChapterProgress = null,Object? primaryTitle = null,Object? secondaryTitle = null,Object? mediaControls = null,}) { + return _then(_NotificationSettings( +fastForwardInterval: null == fastForwardInterval ? _self.fastForwardInterval : fastForwardInterval // ignore: cast_nullable_to_non_nullable +as Duration,rewindInterval: null == rewindInterval ? _self.rewindInterval : rewindInterval // ignore: cast_nullable_to_non_nullable +as Duration,progressBarIsChapterProgress: null == progressBarIsChapterProgress ? _self.progressBarIsChapterProgress : progressBarIsChapterProgress // ignore: cast_nullable_to_non_nullable +as bool,primaryTitle: null == primaryTitle ? _self.primaryTitle : primaryTitle // ignore: cast_nullable_to_non_nullable +as String,secondaryTitle: null == secondaryTitle ? _self.secondaryTitle : secondaryTitle // ignore: cast_nullable_to_non_nullable +as String,mediaControls: null == mediaControls ? _self._mediaControls : mediaControls // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + /// @nodoc mixin _$ShakeDetectionSettings { - bool get isEnabled => throw _privateConstructorUsedError; - ShakeDirection get direction => throw _privateConstructorUsedError; - double get threshold => throw _privateConstructorUsedError; - ShakeAction get shakeAction => throw _privateConstructorUsedError; - Set get feedback => throw _privateConstructorUsedError; - double get beepVolume => throw _privateConstructorUsedError; - /// the duration to wait before the shake detection is enabled again - Duration get shakeTriggerCoolDown => throw _privateConstructorUsedError; - - /// the number of shakes required to trigger the action - int get shakeTriggerCount => throw _privateConstructorUsedError; - - /// acceleration sampling interval - Duration get samplingPeriod => throw _privateConstructorUsedError; + bool get isEnabled; ShakeDirection get direction; double get threshold; ShakeAction get shakeAction; Set get feedback; double get beepVolume;/// the duration to wait before the shake detection is enabled again + Duration get shakeTriggerCoolDown;/// the number of shakes required to trigger the action + int get shakeTriggerCount;/// acceleration sampling interval + Duration get samplingPeriod; +/// Create a copy of ShakeDetectionSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ShakeDetectionSettingsCopyWith get copyWith => _$ShakeDetectionSettingsCopyWithImpl(this as ShakeDetectionSettings, _$identity); /// Serializes this ShakeDetectionSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ShakeDetectionSettings&&(identical(other.isEnabled, isEnabled) || other.isEnabled == isEnabled)&&(identical(other.direction, direction) || other.direction == direction)&&(identical(other.threshold, threshold) || other.threshold == threshold)&&(identical(other.shakeAction, shakeAction) || other.shakeAction == shakeAction)&&const DeepCollectionEquality().equals(other.feedback, feedback)&&(identical(other.beepVolume, beepVolume) || other.beepVolume == beepVolume)&&(identical(other.shakeTriggerCoolDown, shakeTriggerCoolDown) || other.shakeTriggerCoolDown == shakeTriggerCoolDown)&&(identical(other.shakeTriggerCount, shakeTriggerCount) || other.shakeTriggerCount == shakeTriggerCount)&&(identical(other.samplingPeriod, samplingPeriod) || other.samplingPeriod == samplingPeriod)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isEnabled,direction,threshold,shakeAction,const DeepCollectionEquality().hash(feedback),beepVolume,shakeTriggerCoolDown,shakeTriggerCount,samplingPeriod); + +@override +String toString() { + return 'ShakeDetectionSettings(isEnabled: $isEnabled, direction: $direction, threshold: $threshold, shakeAction: $shakeAction, feedback: $feedback, beepVolume: $beepVolume, shakeTriggerCoolDown: $shakeTriggerCoolDown, shakeTriggerCount: $shakeTriggerCount, samplingPeriod: $samplingPeriod)'; +} + - /// Create a copy of ShakeDetectionSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ShakeDetectionSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $ShakeDetectionSettingsCopyWith<$Res> { - factory $ShakeDetectionSettingsCopyWith(ShakeDetectionSettings value, - $Res Function(ShakeDetectionSettings) then) = - _$ShakeDetectionSettingsCopyWithImpl<$Res, ShakeDetectionSettings>; - @useResult - $Res call( - {bool isEnabled, - ShakeDirection direction, - double threshold, - ShakeAction shakeAction, - Set feedback, - double beepVolume, - Duration shakeTriggerCoolDown, - int shakeTriggerCount, - Duration samplingPeriod}); -} +abstract mixin class $ShakeDetectionSettingsCopyWith<$Res> { + factory $ShakeDetectionSettingsCopyWith(ShakeDetectionSettings value, $Res Function(ShakeDetectionSettings) _then) = _$ShakeDetectionSettingsCopyWithImpl; +@useResult +$Res call({ + bool isEnabled, ShakeDirection direction, double threshold, ShakeAction shakeAction, Set feedback, double beepVolume, Duration shakeTriggerCoolDown, int shakeTriggerCount, Duration samplingPeriod +}); + + + +} /// @nodoc -class _$ShakeDetectionSettingsCopyWithImpl<$Res, - $Val extends ShakeDetectionSettings> +class _$ShakeDetectionSettingsCopyWithImpl<$Res> implements $ShakeDetectionSettingsCopyWith<$Res> { - _$ShakeDetectionSettingsCopyWithImpl(this._value, this._then); + _$ShakeDetectionSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final ShakeDetectionSettings _self; + final $Res Function(ShakeDetectionSettings) _then; - /// Create a copy of ShakeDetectionSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? isEnabled = null, - Object? direction = null, - Object? threshold = null, - Object? shakeAction = null, - Object? feedback = null, - Object? beepVolume = null, - Object? shakeTriggerCoolDown = null, - Object? shakeTriggerCount = null, - Object? samplingPeriod = null, - }) { - return _then(_value.copyWith( - isEnabled: null == isEnabled - ? _value.isEnabled - : isEnabled // ignore: cast_nullable_to_non_nullable - as bool, - direction: null == direction - ? _value.direction - : direction // ignore: cast_nullable_to_non_nullable - as ShakeDirection, - threshold: null == threshold - ? _value.threshold - : threshold // ignore: cast_nullable_to_non_nullable - as double, - shakeAction: null == shakeAction - ? _value.shakeAction - : shakeAction // ignore: cast_nullable_to_non_nullable - as ShakeAction, - feedback: null == feedback - ? _value.feedback - : feedback // ignore: cast_nullable_to_non_nullable - as Set, - beepVolume: null == beepVolume - ? _value.beepVolume - : beepVolume // ignore: cast_nullable_to_non_nullable - as double, - shakeTriggerCoolDown: null == shakeTriggerCoolDown - ? _value.shakeTriggerCoolDown - : shakeTriggerCoolDown // ignore: cast_nullable_to_non_nullable - as Duration, - shakeTriggerCount: null == shakeTriggerCount - ? _value.shakeTriggerCount - : shakeTriggerCount // ignore: cast_nullable_to_non_nullable - as int, - samplingPeriod: null == samplingPeriod - ? _value.samplingPeriod - : samplingPeriod // ignore: cast_nullable_to_non_nullable - as Duration, - ) as $Val); - } +/// Create a copy of ShakeDetectionSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? direction = null,Object? threshold = null,Object? shakeAction = null,Object? feedback = null,Object? beepVolume = null,Object? shakeTriggerCoolDown = null,Object? shakeTriggerCount = null,Object? samplingPeriod = null,}) { + return _then(_self.copyWith( +isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable +as bool,direction: null == direction ? _self.direction : direction // ignore: cast_nullable_to_non_nullable +as ShakeDirection,threshold: null == threshold ? _self.threshold : threshold // ignore: cast_nullable_to_non_nullable +as double,shakeAction: null == shakeAction ? _self.shakeAction : shakeAction // ignore: cast_nullable_to_non_nullable +as ShakeAction,feedback: null == feedback ? _self.feedback : feedback // ignore: cast_nullable_to_non_nullable +as Set,beepVolume: null == beepVolume ? _self.beepVolume : beepVolume // ignore: cast_nullable_to_non_nullable +as double,shakeTriggerCoolDown: null == shakeTriggerCoolDown ? _self.shakeTriggerCoolDown : shakeTriggerCoolDown // ignore: cast_nullable_to_non_nullable +as Duration,shakeTriggerCount: null == shakeTriggerCount ? _self.shakeTriggerCount : shakeTriggerCount // ignore: cast_nullable_to_non_nullable +as int,samplingPeriod: null == samplingPeriod ? _self.samplingPeriod : samplingPeriod // ignore: cast_nullable_to_non_nullable +as Duration, + )); } -/// @nodoc -abstract class _$$ShakeDetectionSettingsImplCopyWith<$Res> - implements $ShakeDetectionSettingsCopyWith<$Res> { - factory _$$ShakeDetectionSettingsImplCopyWith( - _$ShakeDetectionSettingsImpl value, - $Res Function(_$ShakeDetectionSettingsImpl) then) = - __$$ShakeDetectionSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {bool isEnabled, - ShakeDirection direction, - double threshold, - ShakeAction shakeAction, - Set feedback, - double beepVolume, - Duration shakeTriggerCoolDown, - int shakeTriggerCount, - Duration samplingPeriod}); } -/// @nodoc -class __$$ShakeDetectionSettingsImplCopyWithImpl<$Res> - extends _$ShakeDetectionSettingsCopyWithImpl<$Res, - _$ShakeDetectionSettingsImpl> - implements _$$ShakeDetectionSettingsImplCopyWith<$Res> { - __$$ShakeDetectionSettingsImplCopyWithImpl( - _$ShakeDetectionSettingsImpl _value, - $Res Function(_$ShakeDetectionSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of ShakeDetectionSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? isEnabled = null, - Object? direction = null, - Object? threshold = null, - Object? shakeAction = null, - Object? feedback = null, - Object? beepVolume = null, - Object? shakeTriggerCoolDown = null, - Object? shakeTriggerCount = null, - Object? samplingPeriod = null, - }) { - return _then(_$ShakeDetectionSettingsImpl( - isEnabled: null == isEnabled - ? _value.isEnabled - : isEnabled // ignore: cast_nullable_to_non_nullable - as bool, - direction: null == direction - ? _value.direction - : direction // ignore: cast_nullable_to_non_nullable - as ShakeDirection, - threshold: null == threshold - ? _value.threshold - : threshold // ignore: cast_nullable_to_non_nullable - as double, - shakeAction: null == shakeAction - ? _value.shakeAction - : shakeAction // ignore: cast_nullable_to_non_nullable - as ShakeAction, - feedback: null == feedback - ? _value._feedback - : feedback // ignore: cast_nullable_to_non_nullable - as Set, - beepVolume: null == beepVolume - ? _value.beepVolume - : beepVolume // ignore: cast_nullable_to_non_nullable - as double, - shakeTriggerCoolDown: null == shakeTriggerCoolDown - ? _value.shakeTriggerCoolDown - : shakeTriggerCoolDown // ignore: cast_nullable_to_non_nullable - as Duration, - shakeTriggerCount: null == shakeTriggerCount - ? _value.shakeTriggerCount - : shakeTriggerCount // ignore: cast_nullable_to_non_nullable - as int, - samplingPeriod: null == samplingPeriod - ? _value.samplingPeriod - : samplingPeriod // ignore: cast_nullable_to_non_nullable - as Duration, - )); - } +/// Adds pattern-matching-related methods to [ShakeDetectionSettings]. +extension ShakeDetectionSettingsPatterns on ShakeDetectionSettings { +/// 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 Function( _ShakeDetectionSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ShakeDetectionSettings() 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 Function( _ShakeDetectionSettings value) $default,){ +final _that = this; +switch (_that) { +case _ShakeDetectionSettings(): +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? Function( _ShakeDetectionSettings value)? $default,){ +final _that = this; +switch (_that) { +case _ShakeDetectionSettings() 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 Function( bool isEnabled, ShakeDirection direction, double threshold, ShakeAction shakeAction, Set feedback, double beepVolume, Duration shakeTriggerCoolDown, int shakeTriggerCount, Duration samplingPeriod)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ShakeDetectionSettings() when $default != null: +return $default(_that.isEnabled,_that.direction,_that.threshold,_that.shakeAction,_that.feedback,_that.beepVolume,_that.shakeTriggerCoolDown,_that.shakeTriggerCount,_that.samplingPeriod);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 Function( bool isEnabled, ShakeDirection direction, double threshold, ShakeAction shakeAction, Set feedback, double beepVolume, Duration shakeTriggerCoolDown, int shakeTriggerCount, Duration samplingPeriod) $default,) {final _that = this; +switch (_that) { +case _ShakeDetectionSettings(): +return $default(_that.isEnabled,_that.direction,_that.threshold,_that.shakeAction,_that.feedback,_that.beepVolume,_that.shakeTriggerCoolDown,_that.shakeTriggerCount,_that.samplingPeriod);} +} +/// 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? Function( bool isEnabled, ShakeDirection direction, double threshold, ShakeAction shakeAction, Set feedback, double beepVolume, Duration shakeTriggerCoolDown, int shakeTriggerCount, Duration samplingPeriod)? $default,) {final _that = this; +switch (_that) { +case _ShakeDetectionSettings() when $default != null: +return $default(_that.isEnabled,_that.direction,_that.threshold,_that.shakeAction,_that.feedback,_that.beepVolume,_that.shakeTriggerCoolDown,_that.shakeTriggerCount,_that.samplingPeriod);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$ShakeDetectionSettingsImpl implements _ShakeDetectionSettings { - const _$ShakeDetectionSettingsImpl( - {this.isEnabled = true, - this.direction = ShakeDirection.horizontal, - this.threshold = 5, - this.shakeAction = ShakeAction.resetSleepTimer, - final Set feedback = const { - ShakeDetectedFeedback.vibrate - }, - this.beepVolume = 0.5, - this.shakeTriggerCoolDown = const Duration(seconds: 2), - this.shakeTriggerCount = 2, - this.samplingPeriod = const Duration(milliseconds: 100)}) - : _feedback = feedback; - factory _$ShakeDetectionSettingsImpl.fromJson(Map json) => - _$$ShakeDetectionSettingsImplFromJson(json); +class _ShakeDetectionSettings implements ShakeDetectionSettings { + const _ShakeDetectionSettings({this.isEnabled = true, this.direction = ShakeDirection.horizontal, this.threshold = 5, this.shakeAction = ShakeAction.resetSleepTimer, final Set feedback = const {ShakeDetectedFeedback.vibrate}, this.beepVolume = 0.5, this.shakeTriggerCoolDown = const Duration(seconds: 2), this.shakeTriggerCount = 2, this.samplingPeriod = const Duration(milliseconds: 100)}): _feedback = feedback; + factory _ShakeDetectionSettings.fromJson(Map json) => _$ShakeDetectionSettingsFromJson(json); - @override - @JsonKey() - final bool isEnabled; - @override - @JsonKey() - final ShakeDirection direction; - @override - @JsonKey() - final double threshold; - @override - @JsonKey() - final ShakeAction shakeAction; - final Set _feedback; - @override - @JsonKey() - Set get feedback { - if (_feedback is EqualUnmodifiableSetView) return _feedback; - // ignore: implicit_dynamic_type - return EqualUnmodifiableSetView(_feedback); - } - - @override - @JsonKey() - final double beepVolume; - - /// the duration to wait before the shake detection is enabled again - @override - @JsonKey() - final Duration shakeTriggerCoolDown; - - /// the number of shakes required to trigger the action - @override - @JsonKey() - final int shakeTriggerCount; - - /// acceleration sampling interval - @override - @JsonKey() - final Duration samplingPeriod; - - @override - String toString() { - return 'ShakeDetectionSettings(isEnabled: $isEnabled, direction: $direction, threshold: $threshold, shakeAction: $shakeAction, feedback: $feedback, beepVolume: $beepVolume, shakeTriggerCoolDown: $shakeTriggerCoolDown, shakeTriggerCount: $shakeTriggerCount, samplingPeriod: $samplingPeriod)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ShakeDetectionSettingsImpl && - (identical(other.isEnabled, isEnabled) || - other.isEnabled == isEnabled) && - (identical(other.direction, direction) || - other.direction == direction) && - (identical(other.threshold, threshold) || - other.threshold == threshold) && - (identical(other.shakeAction, shakeAction) || - other.shakeAction == shakeAction) && - const DeepCollectionEquality().equals(other._feedback, _feedback) && - (identical(other.beepVolume, beepVolume) || - other.beepVolume == beepVolume) && - (identical(other.shakeTriggerCoolDown, shakeTriggerCoolDown) || - other.shakeTriggerCoolDown == shakeTriggerCoolDown) && - (identical(other.shakeTriggerCount, shakeTriggerCount) || - other.shakeTriggerCount == shakeTriggerCount) && - (identical(other.samplingPeriod, samplingPeriod) || - other.samplingPeriod == samplingPeriod)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - isEnabled, - direction, - threshold, - shakeAction, - const DeepCollectionEquality().hash(_feedback), - beepVolume, - shakeTriggerCoolDown, - shakeTriggerCount, - samplingPeriod); - - /// Create a copy of ShakeDetectionSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ShakeDetectionSettingsImplCopyWith<_$ShakeDetectionSettingsImpl> - get copyWith => __$$ShakeDetectionSettingsImplCopyWithImpl< - _$ShakeDetectionSettingsImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ShakeDetectionSettingsImplToJson( - this, - ); - } +@override@JsonKey() final bool isEnabled; +@override@JsonKey() final ShakeDirection direction; +@override@JsonKey() final double threshold; +@override@JsonKey() final ShakeAction shakeAction; + final Set _feedback; +@override@JsonKey() Set get feedback { + if (_feedback is EqualUnmodifiableSetView) return _feedback; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_feedback); } -abstract class _ShakeDetectionSettings implements ShakeDetectionSettings { - const factory _ShakeDetectionSettings( - {final bool isEnabled, - final ShakeDirection direction, - final double threshold, - final ShakeAction shakeAction, - final Set feedback, - final double beepVolume, - final Duration shakeTriggerCoolDown, - final int shakeTriggerCount, - final Duration samplingPeriod}) = _$ShakeDetectionSettingsImpl; +@override@JsonKey() final double beepVolume; +/// the duration to wait before the shake detection is enabled again +@override@JsonKey() final Duration shakeTriggerCoolDown; +/// the number of shakes required to trigger the action +@override@JsonKey() final int shakeTriggerCount; +/// acceleration sampling interval +@override@JsonKey() final Duration samplingPeriod; - factory _ShakeDetectionSettings.fromJson(Map json) = - _$ShakeDetectionSettingsImpl.fromJson; +/// Create a copy of ShakeDetectionSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ShakeDetectionSettingsCopyWith<_ShakeDetectionSettings> get copyWith => __$ShakeDetectionSettingsCopyWithImpl<_ShakeDetectionSettings>(this, _$identity); - @override - bool get isEnabled; - @override - ShakeDirection get direction; - @override - double get threshold; - @override - ShakeAction get shakeAction; - @override - Set get feedback; - @override - double get beepVolume; - - /// the duration to wait before the shake detection is enabled again - @override - Duration get shakeTriggerCoolDown; - - /// the number of shakes required to trigger the action - @override - int get shakeTriggerCount; - - /// acceleration sampling interval - @override - Duration get samplingPeriod; - - /// Create a copy of ShakeDetectionSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ShakeDetectionSettingsImplCopyWith<_$ShakeDetectionSettingsImpl> - get copyWith => throw _privateConstructorUsedError; +@override +Map toJson() { + return _$ShakeDetectionSettingsToJson(this, ); } -HomePageSettings _$HomePageSettingsFromJson(Map json) { - return _HomePageSettings.fromJson(json); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ShakeDetectionSettings&&(identical(other.isEnabled, isEnabled) || other.isEnabled == isEnabled)&&(identical(other.direction, direction) || other.direction == direction)&&(identical(other.threshold, threshold) || other.threshold == threshold)&&(identical(other.shakeAction, shakeAction) || other.shakeAction == shakeAction)&&const DeepCollectionEquality().equals(other._feedback, _feedback)&&(identical(other.beepVolume, beepVolume) || other.beepVolume == beepVolume)&&(identical(other.shakeTriggerCoolDown, shakeTriggerCoolDown) || other.shakeTriggerCoolDown == shakeTriggerCoolDown)&&(identical(other.shakeTriggerCount, shakeTriggerCount) || other.shakeTriggerCount == shakeTriggerCount)&&(identical(other.samplingPeriod, samplingPeriod) || other.samplingPeriod == samplingPeriod)); } +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isEnabled,direction,threshold,shakeAction,const DeepCollectionEquality().hash(_feedback),beepVolume,shakeTriggerCoolDown,shakeTriggerCount,samplingPeriod); + +@override +String toString() { + return 'ShakeDetectionSettings(isEnabled: $isEnabled, direction: $direction, threshold: $threshold, shakeAction: $shakeAction, feedback: $feedback, beepVolume: $beepVolume, shakeTriggerCoolDown: $shakeTriggerCoolDown, shakeTriggerCount: $shakeTriggerCount, samplingPeriod: $samplingPeriod)'; +} + + +} + +/// @nodoc +abstract mixin class _$ShakeDetectionSettingsCopyWith<$Res> implements $ShakeDetectionSettingsCopyWith<$Res> { + factory _$ShakeDetectionSettingsCopyWith(_ShakeDetectionSettings value, $Res Function(_ShakeDetectionSettings) _then) = __$ShakeDetectionSettingsCopyWithImpl; +@override @useResult +$Res call({ + bool isEnabled, ShakeDirection direction, double threshold, ShakeAction shakeAction, Set feedback, double beepVolume, Duration shakeTriggerCoolDown, int shakeTriggerCount, Duration samplingPeriod +}); + + + + +} +/// @nodoc +class __$ShakeDetectionSettingsCopyWithImpl<$Res> + implements _$ShakeDetectionSettingsCopyWith<$Res> { + __$ShakeDetectionSettingsCopyWithImpl(this._self, this._then); + + final _ShakeDetectionSettings _self; + final $Res Function(_ShakeDetectionSettings) _then; + +/// Create a copy of ShakeDetectionSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isEnabled = null,Object? direction = null,Object? threshold = null,Object? shakeAction = null,Object? feedback = null,Object? beepVolume = null,Object? shakeTriggerCoolDown = null,Object? shakeTriggerCount = null,Object? samplingPeriod = null,}) { + return _then(_ShakeDetectionSettings( +isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable +as bool,direction: null == direction ? _self.direction : direction // ignore: cast_nullable_to_non_nullable +as ShakeDirection,threshold: null == threshold ? _self.threshold : threshold // ignore: cast_nullable_to_non_nullable +as double,shakeAction: null == shakeAction ? _self.shakeAction : shakeAction // ignore: cast_nullable_to_non_nullable +as ShakeAction,feedback: null == feedback ? _self._feedback : feedback // ignore: cast_nullable_to_non_nullable +as Set,beepVolume: null == beepVolume ? _self.beepVolume : beepVolume // ignore: cast_nullable_to_non_nullable +as double,shakeTriggerCoolDown: null == shakeTriggerCoolDown ? _self.shakeTriggerCoolDown : shakeTriggerCoolDown // ignore: cast_nullable_to_non_nullable +as Duration,shakeTriggerCount: null == shakeTriggerCount ? _self.shakeTriggerCount : shakeTriggerCount // ignore: cast_nullable_to_non_nullable +as int,samplingPeriod: null == samplingPeriod ? _self.samplingPeriod : samplingPeriod // ignore: cast_nullable_to_non_nullable +as Duration, + )); +} + + +} + + /// @nodoc mixin _$HomePageSettings { - bool get showPlayButtonOnContinueListeningShelf => - throw _privateConstructorUsedError; - bool get showPlayButtonOnContinueSeriesShelf => - throw _privateConstructorUsedError; - bool get showPlayButtonOnAllRemainingShelves => - throw _privateConstructorUsedError; - bool get showPlayButtonOnListenAgainShelf => - throw _privateConstructorUsedError; + + bool get showPlayButtonOnContinueListeningShelf; bool get showPlayButtonOnContinueSeriesShelf; bool get showPlayButtonOnAllRemainingShelves; bool get showPlayButtonOnListenAgainShelf; +/// Create a copy of HomePageSettings +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$HomePageSettingsCopyWith get copyWith => _$HomePageSettingsCopyWithImpl(this as HomePageSettings, _$identity); /// Serializes this HomePageSettings to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is HomePageSettings&&(identical(other.showPlayButtonOnContinueListeningShelf, showPlayButtonOnContinueListeningShelf) || other.showPlayButtonOnContinueListeningShelf == showPlayButtonOnContinueListeningShelf)&&(identical(other.showPlayButtonOnContinueSeriesShelf, showPlayButtonOnContinueSeriesShelf) || other.showPlayButtonOnContinueSeriesShelf == showPlayButtonOnContinueSeriesShelf)&&(identical(other.showPlayButtonOnAllRemainingShelves, showPlayButtonOnAllRemainingShelves) || other.showPlayButtonOnAllRemainingShelves == showPlayButtonOnAllRemainingShelves)&&(identical(other.showPlayButtonOnListenAgainShelf, showPlayButtonOnListenAgainShelf) || other.showPlayButtonOnListenAgainShelf == showPlayButtonOnListenAgainShelf)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,showPlayButtonOnContinueListeningShelf,showPlayButtonOnContinueSeriesShelf,showPlayButtonOnAllRemainingShelves,showPlayButtonOnListenAgainShelf); + +@override +String toString() { + return 'HomePageSettings(showPlayButtonOnContinueListeningShelf: $showPlayButtonOnContinueListeningShelf, showPlayButtonOnContinueSeriesShelf: $showPlayButtonOnContinueSeriesShelf, showPlayButtonOnAllRemainingShelves: $showPlayButtonOnAllRemainingShelves, showPlayButtonOnListenAgainShelf: $showPlayButtonOnListenAgainShelf)'; +} + - /// Create a copy of HomePageSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $HomePageSettingsCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $HomePageSettingsCopyWith<$Res> { - factory $HomePageSettingsCopyWith( - HomePageSettings value, $Res Function(HomePageSettings) then) = - _$HomePageSettingsCopyWithImpl<$Res, HomePageSettings>; - @useResult - $Res call( - {bool showPlayButtonOnContinueListeningShelf, - bool showPlayButtonOnContinueSeriesShelf, - bool showPlayButtonOnAllRemainingShelves, - bool showPlayButtonOnListenAgainShelf}); -} +abstract mixin class $HomePageSettingsCopyWith<$Res> { + factory $HomePageSettingsCopyWith(HomePageSettings value, $Res Function(HomePageSettings) _then) = _$HomePageSettingsCopyWithImpl; +@useResult +$Res call({ + bool showPlayButtonOnContinueListeningShelf, bool showPlayButtonOnContinueSeriesShelf, bool showPlayButtonOnAllRemainingShelves, bool showPlayButtonOnListenAgainShelf +}); + + + +} /// @nodoc -class _$HomePageSettingsCopyWithImpl<$Res, $Val extends HomePageSettings> +class _$HomePageSettingsCopyWithImpl<$Res> implements $HomePageSettingsCopyWith<$Res> { - _$HomePageSettingsCopyWithImpl(this._value, this._then); + _$HomePageSettingsCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final HomePageSettings _self; + final $Res Function(HomePageSettings) _then; - /// Create a copy of HomePageSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? showPlayButtonOnContinueListeningShelf = null, - Object? showPlayButtonOnContinueSeriesShelf = null, - Object? showPlayButtonOnAllRemainingShelves = null, - Object? showPlayButtonOnListenAgainShelf = null, - }) { - return _then(_value.copyWith( - showPlayButtonOnContinueListeningShelf: null == - showPlayButtonOnContinueListeningShelf - ? _value.showPlayButtonOnContinueListeningShelf - : showPlayButtonOnContinueListeningShelf // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnContinueSeriesShelf: null == - showPlayButtonOnContinueSeriesShelf - ? _value.showPlayButtonOnContinueSeriesShelf - : showPlayButtonOnContinueSeriesShelf // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnAllRemainingShelves: null == - showPlayButtonOnAllRemainingShelves - ? _value.showPlayButtonOnAllRemainingShelves - : showPlayButtonOnAllRemainingShelves // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnListenAgainShelf: null == showPlayButtonOnListenAgainShelf - ? _value.showPlayButtonOnListenAgainShelf - : showPlayButtonOnListenAgainShelf // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } +/// Create a copy of HomePageSettings +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? showPlayButtonOnContinueListeningShelf = null,Object? showPlayButtonOnContinueSeriesShelf = null,Object? showPlayButtonOnAllRemainingShelves = null,Object? showPlayButtonOnListenAgainShelf = null,}) { + return _then(_self.copyWith( +showPlayButtonOnContinueListeningShelf: null == showPlayButtonOnContinueListeningShelf ? _self.showPlayButtonOnContinueListeningShelf : showPlayButtonOnContinueListeningShelf // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnContinueSeriesShelf: null == showPlayButtonOnContinueSeriesShelf ? _self.showPlayButtonOnContinueSeriesShelf : showPlayButtonOnContinueSeriesShelf // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnAllRemainingShelves: null == showPlayButtonOnAllRemainingShelves ? _self.showPlayButtonOnAllRemainingShelves : showPlayButtonOnAllRemainingShelves // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnListenAgainShelf: null == showPlayButtonOnListenAgainShelf ? _self.showPlayButtonOnListenAgainShelf : showPlayButtonOnListenAgainShelf // ignore: cast_nullable_to_non_nullable +as bool, + )); } -/// @nodoc -abstract class _$$HomePageSettingsImplCopyWith<$Res> - implements $HomePageSettingsCopyWith<$Res> { - factory _$$HomePageSettingsImplCopyWith(_$HomePageSettingsImpl value, - $Res Function(_$HomePageSettingsImpl) then) = - __$$HomePageSettingsImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {bool showPlayButtonOnContinueListeningShelf, - bool showPlayButtonOnContinueSeriesShelf, - bool showPlayButtonOnAllRemainingShelves, - bool showPlayButtonOnListenAgainShelf}); } -/// @nodoc -class __$$HomePageSettingsImplCopyWithImpl<$Res> - extends _$HomePageSettingsCopyWithImpl<$Res, _$HomePageSettingsImpl> - implements _$$HomePageSettingsImplCopyWith<$Res> { - __$$HomePageSettingsImplCopyWithImpl(_$HomePageSettingsImpl _value, - $Res Function(_$HomePageSettingsImpl) _then) - : super(_value, _then); - /// Create a copy of HomePageSettings - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? showPlayButtonOnContinueListeningShelf = null, - Object? showPlayButtonOnContinueSeriesShelf = null, - Object? showPlayButtonOnAllRemainingShelves = null, - Object? showPlayButtonOnListenAgainShelf = null, - }) { - return _then(_$HomePageSettingsImpl( - showPlayButtonOnContinueListeningShelf: null == - showPlayButtonOnContinueListeningShelf - ? _value.showPlayButtonOnContinueListeningShelf - : showPlayButtonOnContinueListeningShelf // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnContinueSeriesShelf: null == - showPlayButtonOnContinueSeriesShelf - ? _value.showPlayButtonOnContinueSeriesShelf - : showPlayButtonOnContinueSeriesShelf // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnAllRemainingShelves: null == - showPlayButtonOnAllRemainingShelves - ? _value.showPlayButtonOnAllRemainingShelves - : showPlayButtonOnAllRemainingShelves // ignore: cast_nullable_to_non_nullable - as bool, - showPlayButtonOnListenAgainShelf: null == showPlayButtonOnListenAgainShelf - ? _value.showPlayButtonOnListenAgainShelf - : showPlayButtonOnListenAgainShelf // ignore: cast_nullable_to_non_nullable - as bool, - )); - } +/// Adds pattern-matching-related methods to [HomePageSettings]. +extension HomePageSettingsPatterns on HomePageSettings { +/// 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 Function( _HomePageSettings value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _HomePageSettings() 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 Function( _HomePageSettings value) $default,){ +final _that = this; +switch (_that) { +case _HomePageSettings(): +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? Function( _HomePageSettings value)? $default,){ +final _that = this; +switch (_that) { +case _HomePageSettings() 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 Function( bool showPlayButtonOnContinueListeningShelf, bool showPlayButtonOnContinueSeriesShelf, bool showPlayButtonOnAllRemainingShelves, bool showPlayButtonOnListenAgainShelf)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _HomePageSettings() when $default != null: +return $default(_that.showPlayButtonOnContinueListeningShelf,_that.showPlayButtonOnContinueSeriesShelf,_that.showPlayButtonOnAllRemainingShelves,_that.showPlayButtonOnListenAgainShelf);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 Function( bool showPlayButtonOnContinueListeningShelf, bool showPlayButtonOnContinueSeriesShelf, bool showPlayButtonOnAllRemainingShelves, bool showPlayButtonOnListenAgainShelf) $default,) {final _that = this; +switch (_that) { +case _HomePageSettings(): +return $default(_that.showPlayButtonOnContinueListeningShelf,_that.showPlayButtonOnContinueSeriesShelf,_that.showPlayButtonOnAllRemainingShelves,_that.showPlayButtonOnListenAgainShelf);} +} +/// 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? Function( bool showPlayButtonOnContinueListeningShelf, bool showPlayButtonOnContinueSeriesShelf, bool showPlayButtonOnAllRemainingShelves, bool showPlayButtonOnListenAgainShelf)? $default,) {final _that = this; +switch (_that) { +case _HomePageSettings() when $default != null: +return $default(_that.showPlayButtonOnContinueListeningShelf,_that.showPlayButtonOnContinueSeriesShelf,_that.showPlayButtonOnAllRemainingShelves,_that.showPlayButtonOnListenAgainShelf);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$HomePageSettingsImpl implements _HomePageSettings { - const _$HomePageSettingsImpl( - {this.showPlayButtonOnContinueListeningShelf = true, - this.showPlayButtonOnContinueSeriesShelf = false, - this.showPlayButtonOnAllRemainingShelves = false, - this.showPlayButtonOnListenAgainShelf = false}); - factory _$HomePageSettingsImpl.fromJson(Map json) => - _$$HomePageSettingsImplFromJson(json); +class _HomePageSettings implements HomePageSettings { + const _HomePageSettings({this.showPlayButtonOnContinueListeningShelf = true, this.showPlayButtonOnContinueSeriesShelf = false, this.showPlayButtonOnAllRemainingShelves = false, this.showPlayButtonOnListenAgainShelf = false}); + factory _HomePageSettings.fromJson(Map json) => _$HomePageSettingsFromJson(json); - @override - @JsonKey() - final bool showPlayButtonOnContinueListeningShelf; - @override - @JsonKey() - final bool showPlayButtonOnContinueSeriesShelf; - @override - @JsonKey() - final bool showPlayButtonOnAllRemainingShelves; - @override - @JsonKey() - final bool showPlayButtonOnListenAgainShelf; +@override@JsonKey() final bool showPlayButtonOnContinueListeningShelf; +@override@JsonKey() final bool showPlayButtonOnContinueSeriesShelf; +@override@JsonKey() final bool showPlayButtonOnAllRemainingShelves; +@override@JsonKey() final bool showPlayButtonOnListenAgainShelf; - @override - String toString() { - return 'HomePageSettings(showPlayButtonOnContinueListeningShelf: $showPlayButtonOnContinueListeningShelf, showPlayButtonOnContinueSeriesShelf: $showPlayButtonOnContinueSeriesShelf, showPlayButtonOnAllRemainingShelves: $showPlayButtonOnAllRemainingShelves, showPlayButtonOnListenAgainShelf: $showPlayButtonOnListenAgainShelf)'; - } +/// Create a copy of HomePageSettings +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$HomePageSettingsCopyWith<_HomePageSettings> get copyWith => __$HomePageSettingsCopyWithImpl<_HomePageSettings>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$HomePageSettingsImpl && - (identical(other.showPlayButtonOnContinueListeningShelf, - showPlayButtonOnContinueListeningShelf) || - other.showPlayButtonOnContinueListeningShelf == - showPlayButtonOnContinueListeningShelf) && - (identical(other.showPlayButtonOnContinueSeriesShelf, - showPlayButtonOnContinueSeriesShelf) || - other.showPlayButtonOnContinueSeriesShelf == - showPlayButtonOnContinueSeriesShelf) && - (identical(other.showPlayButtonOnAllRemainingShelves, - showPlayButtonOnAllRemainingShelves) || - other.showPlayButtonOnAllRemainingShelves == - showPlayButtonOnAllRemainingShelves) && - (identical(other.showPlayButtonOnListenAgainShelf, - showPlayButtonOnListenAgainShelf) || - other.showPlayButtonOnListenAgainShelf == - showPlayButtonOnListenAgainShelf)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - showPlayButtonOnContinueListeningShelf, - showPlayButtonOnContinueSeriesShelf, - showPlayButtonOnAllRemainingShelves, - showPlayButtonOnListenAgainShelf); - - /// Create a copy of HomePageSettings - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$HomePageSettingsImplCopyWith<_$HomePageSettingsImpl> get copyWith => - __$$HomePageSettingsImplCopyWithImpl<_$HomePageSettingsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$HomePageSettingsImplToJson( - this, - ); - } +@override +Map toJson() { + return _$HomePageSettingsToJson(this, ); } -abstract class _HomePageSettings implements HomePageSettings { - const factory _HomePageSettings( - {final bool showPlayButtonOnContinueListeningShelf, - final bool showPlayButtonOnContinueSeriesShelf, - final bool showPlayButtonOnAllRemainingShelves, - final bool showPlayButtonOnListenAgainShelf}) = _$HomePageSettingsImpl; - - factory _HomePageSettings.fromJson(Map json) = - _$HomePageSettingsImpl.fromJson; - - @override - bool get showPlayButtonOnContinueListeningShelf; - @override - bool get showPlayButtonOnContinueSeriesShelf; - @override - bool get showPlayButtonOnAllRemainingShelves; - @override - bool get showPlayButtonOnListenAgainShelf; - - /// Create a copy of HomePageSettings - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$HomePageSettingsImplCopyWith<_$HomePageSettingsImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HomePageSettings&&(identical(other.showPlayButtonOnContinueListeningShelf, showPlayButtonOnContinueListeningShelf) || other.showPlayButtonOnContinueListeningShelf == showPlayButtonOnContinueListeningShelf)&&(identical(other.showPlayButtonOnContinueSeriesShelf, showPlayButtonOnContinueSeriesShelf) || other.showPlayButtonOnContinueSeriesShelf == showPlayButtonOnContinueSeriesShelf)&&(identical(other.showPlayButtonOnAllRemainingShelves, showPlayButtonOnAllRemainingShelves) || other.showPlayButtonOnAllRemainingShelves == showPlayButtonOnAllRemainingShelves)&&(identical(other.showPlayButtonOnListenAgainShelf, showPlayButtonOnListenAgainShelf) || other.showPlayButtonOnListenAgainShelf == showPlayButtonOnListenAgainShelf)); } + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,showPlayButtonOnContinueListeningShelf,showPlayButtonOnContinueSeriesShelf,showPlayButtonOnAllRemainingShelves,showPlayButtonOnListenAgainShelf); + +@override +String toString() { + return 'HomePageSettings(showPlayButtonOnContinueListeningShelf: $showPlayButtonOnContinueListeningShelf, showPlayButtonOnContinueSeriesShelf: $showPlayButtonOnContinueSeriesShelf, showPlayButtonOnAllRemainingShelves: $showPlayButtonOnAllRemainingShelves, showPlayButtonOnListenAgainShelf: $showPlayButtonOnListenAgainShelf)'; +} + + +} + +/// @nodoc +abstract mixin class _$HomePageSettingsCopyWith<$Res> implements $HomePageSettingsCopyWith<$Res> { + factory _$HomePageSettingsCopyWith(_HomePageSettings value, $Res Function(_HomePageSettings) _then) = __$HomePageSettingsCopyWithImpl; +@override @useResult +$Res call({ + bool showPlayButtonOnContinueListeningShelf, bool showPlayButtonOnContinueSeriesShelf, bool showPlayButtonOnAllRemainingShelves, bool showPlayButtonOnListenAgainShelf +}); + + + + +} +/// @nodoc +class __$HomePageSettingsCopyWithImpl<$Res> + implements _$HomePageSettingsCopyWith<$Res> { + __$HomePageSettingsCopyWithImpl(this._self, this._then); + + final _HomePageSettings _self; + final $Res Function(_HomePageSettings) _then; + +/// Create a copy of HomePageSettings +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? showPlayButtonOnContinueListeningShelf = null,Object? showPlayButtonOnContinueSeriesShelf = null,Object? showPlayButtonOnAllRemainingShelves = null,Object? showPlayButtonOnListenAgainShelf = null,}) { + return _then(_HomePageSettings( +showPlayButtonOnContinueListeningShelf: null == showPlayButtonOnContinueListeningShelf ? _self.showPlayButtonOnContinueListeningShelf : showPlayButtonOnContinueListeningShelf // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnContinueSeriesShelf: null == showPlayButtonOnContinueSeriesShelf ? _self.showPlayButtonOnContinueSeriesShelf : showPlayButtonOnContinueSeriesShelf // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnAllRemainingShelves: null == showPlayButtonOnAllRemainingShelves ? _self.showPlayButtonOnAllRemainingShelves : showPlayButtonOnAllRemainingShelves // ignore: cast_nullable_to_non_nullable +as bool,showPlayButtonOnListenAgainShelf: null == showPlayButtonOnListenAgainShelf ? _self.showPlayButtonOnListenAgainShelf : showPlayButtonOnListenAgainShelf // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +// dart format on diff --git a/lib/settings/models/app_settings.g.dart b/lib/settings/models/app_settings.g.dart index 131458c..003dac8 100644 --- a/lib/settings/models/app_settings.g.dart +++ b/lib/settings/models/app_settings.g.dart @@ -6,39 +6,41 @@ part of 'app_settings.dart'; // JsonSerializableGenerator // ************************************************************************** -_$AppSettingsImpl _$$AppSettingsImplFromJson(Map json) => - _$AppSettingsImpl( - themeSettings: json['themeSettings'] == null - ? const ThemeSettings() - : ThemeSettings.fromJson( - json['themeSettings'] as Map), - playerSettings: json['playerSettings'] == null - ? const PlayerSettings() - : PlayerSettings.fromJson( - json['playerSettings'] as Map), - sleepTimerSettings: json['sleepTimerSettings'] == null - ? const SleepTimerSettings() - : SleepTimerSettings.fromJson( - json['sleepTimerSettings'] as Map), - downloadSettings: json['downloadSettings'] == null - ? const DownloadSettings() - : DownloadSettings.fromJson( - json['downloadSettings'] as Map), - notificationSettings: json['notificationSettings'] == null - ? const NotificationSettings() - : NotificationSettings.fromJson( - json['notificationSettings'] as Map), - shakeDetectionSettings: json['shakeDetectionSettings'] == null - ? const ShakeDetectionSettings() - : ShakeDetectionSettings.fromJson( - json['shakeDetectionSettings'] as Map), - homePageSettings: json['homePageSettings'] == null - ? const HomePageSettings() - : HomePageSettings.fromJson( - json['homePageSettings'] as Map), - ); +_AppSettings _$AppSettingsFromJson(Map json) => _AppSettings( + themeSettings: json['themeSettings'] == null + ? const ThemeSettings() + : ThemeSettings.fromJson(json['themeSettings'] as Map), + playerSettings: json['playerSettings'] == null + ? const PlayerSettings() + : PlayerSettings.fromJson(json['playerSettings'] as Map), + sleepTimerSettings: json['sleepTimerSettings'] == null + ? const SleepTimerSettings() + : SleepTimerSettings.fromJson( + json['sleepTimerSettings'] as Map, + ), + downloadSettings: json['downloadSettings'] == null + ? const DownloadSettings() + : DownloadSettings.fromJson( + json['downloadSettings'] as Map, + ), + notificationSettings: json['notificationSettings'] == null + ? const NotificationSettings() + : NotificationSettings.fromJson( + json['notificationSettings'] as Map, + ), + shakeDetectionSettings: json['shakeDetectionSettings'] == null + ? const ShakeDetectionSettings() + : ShakeDetectionSettings.fromJson( + json['shakeDetectionSettings'] as Map, + ), + homePageSettings: json['homePageSettings'] == null + ? const HomePageSettings() + : HomePageSettings.fromJson( + json['homePageSettings'] as Map, + ), +); -Map _$$AppSettingsImplToJson(_$AppSettingsImpl instance) => +Map _$AppSettingsToJson(_AppSettings instance) => { 'themeSettings': instance.themeSettings, 'playerSettings': instance.playerSettings, @@ -49,9 +51,10 @@ Map _$$AppSettingsImplToJson(_$AppSettingsImpl instance) => 'homePageSettings': instance.homePageSettings, }; -_$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map json) => - _$ThemeSettingsImpl( - themeMode: $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ?? +_ThemeSettings _$ThemeSettingsFromJson(Map json) => + _ThemeSettings( + themeMode: + $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']) ?? ThemeMode.system, highContrast: json['highContrast'] as bool? ?? false, useMaterialThemeFromSystem: @@ -63,7 +66,7 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map json) => json['useCurrentPlayerThemeThroughoutApp'] as bool? ?? true, ); -Map _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) => +Map _$ThemeSettingsToJson(_ThemeSettings instance) => { 'themeMode': _$ThemeModeEnumMap[instance.themeMode]!, 'highContrast': instance.highContrast, @@ -80,96 +83,97 @@ const _$ThemeModeEnumMap = { ThemeMode.dark: 'dark', }; -_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map json) => - _$PlayerSettingsImpl( - miniPlayerSettings: json['miniPlayerSettings'] == null - ? const MinimizedPlayerSettings() - : MinimizedPlayerSettings.fromJson( - json['miniPlayerSettings'] as Map), - expandedPlayerSettings: json['expandedPlayerSettings'] == null - ? const ExpandedPlayerSettings() - : ExpandedPlayerSettings.fromJson( - json['expandedPlayerSettings'] as Map), - preferredDefaultVolume: - (json['preferredDefaultVolume'] as num?)?.toDouble() ?? 1, - preferredDefaultSpeed: - (json['preferredDefaultSpeed'] as num?)?.toDouble() ?? 1, - speedOptions: (json['speedOptions'] as List?) - ?.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 json, +) => _PlayerSettings( + miniPlayerSettings: json['miniPlayerSettings'] == null + ? const MinimizedPlayerSettings() + : MinimizedPlayerSettings.fromJson( + json['miniPlayerSettings'] as Map, + ), + expandedPlayerSettings: json['expandedPlayerSettings'] == null + ? const ExpandedPlayerSettings() + : ExpandedPlayerSettings.fromJson( + json['expandedPlayerSettings'] as Map, + ), + preferredDefaultVolume: + (json['preferredDefaultVolume'] as num?)?.toDouble() ?? 1, + preferredDefaultSpeed: + (json['preferredDefaultSpeed'] as num?)?.toDouble() ?? 1, + speedOptions: + (json['speedOptions'] as List?) + ?.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 _$$PlayerSettingsImplToJson( - _$PlayerSettingsImpl instance) => - { - '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 _$PlayerSettingsToJson( + _PlayerSettings instance, +) => { + '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 json) => - _$ExpandedPlayerSettingsImpl( - showTotalProgress: json['showTotalProgress'] as bool? ?? false, - showChapterProgress: json['showChapterProgress'] as bool? ?? true, - ); +_ExpandedPlayerSettings _$ExpandedPlayerSettingsFromJson( + Map json, +) => _ExpandedPlayerSettings( + showTotalProgress: json['showTotalProgress'] as bool? ?? false, + showChapterProgress: json['showChapterProgress'] as bool? ?? true, +); -Map _$$ExpandedPlayerSettingsImplToJson( - _$ExpandedPlayerSettingsImpl instance) => - { - 'showTotalProgress': instance.showTotalProgress, - 'showChapterProgress': instance.showChapterProgress, - }; +Map _$ExpandedPlayerSettingsToJson( + _ExpandedPlayerSettings instance, +) => { + 'showTotalProgress': instance.showTotalProgress, + 'showChapterProgress': instance.showChapterProgress, +}; -_$MinimizedPlayerSettingsImpl _$$MinimizedPlayerSettingsImplFromJson( - Map json) => - _$MinimizedPlayerSettingsImpl( - useChapterInfo: json['useChapterInfo'] as bool? ?? false, - ); +_MinimizedPlayerSettings _$MinimizedPlayerSettingsFromJson( + Map json, +) => _MinimizedPlayerSettings( + useChapterInfo: json['useChapterInfo'] as bool? ?? false, +); -Map _$$MinimizedPlayerSettingsImplToJson( - _$MinimizedPlayerSettingsImpl instance) => - { - 'useChapterInfo': instance.useChapterInfo, - }; +Map _$MinimizedPlayerSettingsToJson( + _MinimizedPlayerSettings instance, +) => {'useChapterInfo': instance.useChapterInfo}; -_$SleepTimerSettingsImpl _$$SleepTimerSettingsImplFromJson( - Map json) => - _$SleepTimerSettingsImpl( +_SleepTimerSettings _$SleepTimerSettingsFromJson(Map json) => + _SleepTimerSettings( defaultDuration: json['defaultDuration'] == null ? const Duration(minutes: 15) : Duration(microseconds: (json['defaultDuration'] as num).toInt()), - presetDurations: (json['presetDurations'] as List?) + presetDurations: + (json['presetDurations'] as List?) ?.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?)?.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 _$$SleepTimerSettingsImplToJson( - _$SleepTimerSettingsImpl instance) => +Map _$SleepTimerSettingsToJson(_SleepTimerSettings instance) => { '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 json) => - _$DownloadSettingsImpl( +_DownloadSettings _$DownloadSettingsFromJson(Map 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 _$$DownloadSettingsImplToJson( - _$DownloadSettingsImpl instance) => +Map _$DownloadSettingsToJson(_DownloadSettings instance) => { 'requiresWiFi': instance.requiresWiFi, 'retries': instance.retries, @@ -250,43 +255,43 @@ Map _$$DownloadSettingsImplToJson( 'maxConcurrentByGroup': instance.maxConcurrentByGroup, }; -_$NotificationSettingsImpl _$$NotificationSettingsImplFromJson( - Map 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?) - ?.map((e) => $enumDecode(_$NotificationMediaControlEnumMap, e)) - .toList() ?? - const [ - NotificationMediaControl.rewind, - NotificationMediaControl.fastForward, - NotificationMediaControl.skipToPreviousChapter, - NotificationMediaControl.skipToNextChapter - ], - ); +_NotificationSettings _$NotificationSettingsFromJson( + Map 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?) + ?.map((e) => $enumDecode(_$NotificationMediaControlEnumMap, e)) + .toList() ?? + const [ + NotificationMediaControl.rewind, + NotificationMediaControl.fastForward, + NotificationMediaControl.skipToPreviousChapter, + NotificationMediaControl.skipToNextChapter, + ], +); -Map _$$NotificationSettingsImplToJson( - _$NotificationSettingsImpl instance) => - { - '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 _$NotificationSettingsToJson( + _NotificationSettings instance, +) => { + '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 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?) - ?.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 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?) + ?.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 _$$ShakeDetectionSettingsImplToJson( - _$ShakeDetectionSettingsImpl instance) => - { - '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 _$ShakeDetectionSettingsToJson( + _ShakeDetectionSettings instance, +) => { + '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 json) => - _$HomePageSettingsImpl( +_HomePageSettings _$HomePageSettingsFromJson(Map json) => + _HomePageSettings( showPlayButtonOnContinueListeningShelf: json['showPlayButtonOnContinueListeningShelf'] as bool? ?? true, showPlayButtonOnContinueSeriesShelf: @@ -370,15 +374,14 @@ _$HomePageSettingsImpl _$$HomePageSettingsImplFromJson( json['showPlayButtonOnListenAgainShelf'] as bool? ?? false, ); -Map _$$HomePageSettingsImplToJson( - _$HomePageSettingsImpl instance) => - { - 'showPlayButtonOnContinueListeningShelf': - instance.showPlayButtonOnContinueListeningShelf, - 'showPlayButtonOnContinueSeriesShelf': - instance.showPlayButtonOnContinueSeriesShelf, - 'showPlayButtonOnAllRemainingShelves': - instance.showPlayButtonOnAllRemainingShelves, - 'showPlayButtonOnListenAgainShelf': - instance.showPlayButtonOnListenAgainShelf, - }; +Map _$HomePageSettingsToJson( + _HomePageSettings instance, +) => { + 'showPlayButtonOnContinueListeningShelf': + instance.showPlayButtonOnContinueListeningShelf, + 'showPlayButtonOnContinueSeriesShelf': + instance.showPlayButtonOnContinueSeriesShelf, + 'showPlayButtonOnAllRemainingShelves': + instance.showPlayButtonOnAllRemainingShelves, + 'showPlayButtonOnListenAgainShelf': instance.showPlayButtonOnListenAgainShelf, +}; diff --git a/lib/settings/models/audiobookshelf_server.dart b/lib/settings/models/audiobookshelf_server.dart index 0c97e41..cbc14a2 100644 --- a/lib/settings/models/audiobookshelf_server.dart +++ b/lib/settings/models/audiobookshelf_server.dart @@ -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, diff --git a/lib/settings/models/audiobookshelf_server.freezed.dart b/lib/settings/models/audiobookshelf_server.freezed.dart index 39f095a..26ec5c4 100644 --- a/lib/settings/models/audiobookshelf_server.freezed.dart +++ b/lib/settings/models/audiobookshelf_server.freezed.dart @@ -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 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 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 get copyWith => _$AudiobookShelfServerCopyWithImpl(this as AudiobookShelfServer, _$identity); /// Serializes this AudiobookShelfServer to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map 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 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 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 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? 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 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 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? 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 json) => - _$$AudiobookShelfServerImplFromJson(json); +class _AudiobookShelfServer implements AudiobookShelfServer { + const _AudiobookShelfServer({required this.serverUrl}); + factory _AudiobookShelfServer.fromJson(Map 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 toJson() { - return _$$AudiobookShelfServerImplToJson( - this, - ); - } +@override +Map toJson() { + return _$AudiobookShelfServerToJson(this, ); } -abstract class _AudiobookShelfServer implements AudiobookShelfServer { - const factory _AudiobookShelfServer({required final Uri serverUrl}) = - _$AudiobookShelfServerImpl; - - factory _AudiobookShelfServer.fromJson(Map 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 diff --git a/lib/settings/models/audiobookshelf_server.g.dart b/lib/settings/models/audiobookshelf_server.g.dart index a876683..e8504ec 100644 --- a/lib/settings/models/audiobookshelf_server.g.dart +++ b/lib/settings/models/audiobookshelf_server.g.dart @@ -6,14 +6,10 @@ part of 'audiobookshelf_server.dart'; // JsonSerializableGenerator // ************************************************************************** -_$AudiobookShelfServerImpl _$$AudiobookShelfServerImplFromJson( - Map json) => - _$AudiobookShelfServerImpl( - serverUrl: Uri.parse(json['serverUrl'] as String), - ); +_AudiobookShelfServer _$AudiobookShelfServerFromJson( + Map json, +) => _AudiobookShelfServer(serverUrl: Uri.parse(json['serverUrl'] as String)); -Map _$$AudiobookShelfServerImplToJson( - _$AudiobookShelfServerImpl instance) => - { - 'serverUrl': instance.serverUrl.toString(), - }; +Map _$AudiobookShelfServerToJson( + _AudiobookShelfServer instance, +) => {'serverUrl': instance.serverUrl.toString()}; diff --git a/lib/settings/models/authenticated_user.dart b/lib/settings/models/authenticated_user.dart index 321c885..97613ab 100644 --- a/lib/settings/models/authenticated_user.dart +++ b/lib/settings/models/authenticated_user.dart @@ -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, diff --git a/lib/settings/models/authenticated_user.freezed.dart b/lib/settings/models/authenticated_user.freezed.dart index 2a7ce53..3010150 100644 --- a/lib/settings/models/authenticated_user.freezed.dart +++ b/lib/settings/models/authenticated_user.freezed.dart @@ -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 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 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 get copyWith => _$AuthenticatedUserCopyWithImpl(this as AuthenticatedUser, _$identity); /// Serializes this AuthenticatedUser to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + Map 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 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 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 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? 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 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 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? 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 json) => - _$$AuthenticatedUserImplFromJson(json); +class _AuthenticatedUser implements AuthenticatedUser { + const _AuthenticatedUser({required this.server, required this.authToken, required this.id, this.username}); + factory _AuthenticatedUser.fromJson(Map 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 toJson() { - return _$$AuthenticatedUserImplToJson( - this, - ); - } +@override +Map 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 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 diff --git a/lib/settings/models/authenticated_user.g.dart b/lib/settings/models/authenticated_user.g.dart index 4ff5a06..926c7d8 100644 --- a/lib/settings/models/authenticated_user.g.dart +++ b/lib/settings/models/authenticated_user.g.dart @@ -6,18 +6,17 @@ part of 'authenticated_user.dart'; // JsonSerializableGenerator // ************************************************************************** -_$AuthenticatedUserImpl _$$AuthenticatedUserImplFromJson( - Map json) => - _$AuthenticatedUserImpl( - server: - AudiobookShelfServer.fromJson(json['server'] as Map), +_AuthenticatedUser _$AuthenticatedUserFromJson(Map json) => + _AuthenticatedUser( + server: AudiobookShelfServer.fromJson( + json['server'] as Map, + ), authToken: json['authToken'] as String, id: json['id'] as String, username: json['username'] as String?, ); -Map _$$AuthenticatedUserImplToJson( - _$AuthenticatedUserImpl instance) => +Map _$AuthenticatedUserToJson(_AuthenticatedUser instance) => { 'server': instance.server, 'authToken': instance.authToken, diff --git a/lib/shared/widgets/shelves/book_shelf.dart b/lib/shared/widgets/shelves/book_shelf.dart index 4fad4be..7b21820 100644 --- a/lib/shared/widgets/shelves/book_shelf.dart +++ b/lib/shared/widgets/shelves/book_shelf.dart @@ -217,7 +217,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget { player.book?.libraryItemId == libraryItemId; final isPlayingThisBook = player.playing && isCurrentBookSetInPlayer; - final userProgress = me.valueOrNull?.mediaProgress + final userProgress = me.value?.mediaProgress ?.firstWhereOrNull((element) => element.libraryItemId == libraryItemId); final isBookCompleted = userProgress?.isFinished ?? false; @@ -243,7 +243,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget { // if current book is set in player, get theme from the cover image data: ThemeData( colorScheme: - coverColorScheme.valueOrNull ?? Theme.of(context).colorScheme, + coverColorScheme.value ?? Theme.of(context).colorScheme, ), child: Padding( padding: EdgeInsets.all(strokeWidth / 2 + 2), diff --git a/lib/theme/providers/system_theme_provider.g.dart b/lib/theme/providers/system_theme_provider.g.dart index 5685c95..a28f0f0 100644 --- a/lib/theme/providers/system_theme_provider.g.dart +++ b/lib/theme/providers/system_theme_provider.g.dart @@ -6,174 +6,91 @@ part of 'system_theme_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$systemThemeHash() => r'c78d3d94683624a80b296594268c5fd4295e77a3'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// copied from [DynamicColorBuilder] -/// -/// Copied from [systemTheme]. + @ProviderFor(systemTheme) -const systemThemeProvider = SystemThemeFamily(); +final systemThemeProvider = SystemThemeFamily._(); /// copied from [DynamicColorBuilder] -/// -/// Copied from [systemTheme]. -class SystemThemeFamily - extends Family> { - /// copied from [DynamicColorBuilder] - /// - /// Copied from [systemTheme]. - const SystemThemeFamily(); +final class SystemThemeProvider + extends + $FunctionalProvider< + AsyncValue<(ColorScheme, ColorScheme)?>, + (ColorScheme, ColorScheme)?, + FutureOr<(ColorScheme, ColorScheme)?> + > + with + $FutureModifier<(ColorScheme, ColorScheme)?>, + $FutureProvider<(ColorScheme, ColorScheme)?> { /// copied from [DynamicColorBuilder] - /// - /// Copied from [systemTheme]. - SystemThemeProvider call({ - bool highContrast = false, - }) { - return SystemThemeProvider( - highContrast: highContrast, - ); + SystemThemeProvider._({ + required SystemThemeFamily super.from, + required bool super.argument, + }) : super( + retry: null, + name: r'systemThemeProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$systemThemeHash(); + + @override + String toString() { + return r'systemThemeProvider' + '' + '($argument)'; } + @$internal @override - SystemThemeProvider getProviderOverride( - covariant SystemThemeProvider provider, - ) { - return call( - highContrast: provider.highContrast, - ); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement<(ColorScheme, ColorScheme)?> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'systemThemeProvider'; -} - -/// copied from [DynamicColorBuilder] -/// -/// Copied from [systemTheme]. -class SystemThemeProvider - extends FutureProvider<(ColorScheme light, ColorScheme dark)?> { - /// copied from [DynamicColorBuilder] - /// - /// Copied from [systemTheme]. - SystemThemeProvider({ - bool highContrast = false, - }) : this._internal( - (ref) => systemTheme( - ref as SystemThemeRef, - highContrast: highContrast, - ), - from: systemThemeProvider, - name: r'systemThemeProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$systemThemeHash, - dependencies: SystemThemeFamily._dependencies, - allTransitiveDependencies: - SystemThemeFamily._allTransitiveDependencies, - highContrast: highContrast, - ); - - SystemThemeProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.highContrast, - }) : super.internal(); - - final bool highContrast; - - @override - Override overrideWith( - FutureOr<(ColorScheme light, ColorScheme dark)?> Function( - SystemThemeRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: SystemThemeProvider._internal( - (ref) => create(ref as SystemThemeRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - highContrast: highContrast, - ), - ); - } - - @override - FutureProviderElement<(ColorScheme light, ColorScheme dark)?> - createElement() { - return _SystemThemeProviderElement(this); + FutureOr<(ColorScheme, ColorScheme)?> create(Ref ref) { + final argument = this.argument as bool; + return systemTheme(ref, highContrast: argument); } @override bool operator ==(Object other) { - return other is SystemThemeProvider && other.highContrast == highContrast; + return other is SystemThemeProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, highContrast.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SystemThemeRef - on FutureProviderRef<(ColorScheme light, ColorScheme dark)?> { - /// The parameter `highContrast` of this provider. - bool get highContrast; -} +String _$systemThemeHash() => r'c78d3d94683624a80b296594268c5fd4295e77a3'; -class _SystemThemeProviderElement - extends FutureProviderElement<(ColorScheme light, ColorScheme dark)?> - with SystemThemeRef { - _SystemThemeProviderElement(super.provider); +/// copied from [DynamicColorBuilder] + +final class SystemThemeFamily extends $Family + with + $FunctionalFamilyOverride, bool> { + SystemThemeFamily._() + : super( + retry: null, + name: r'systemThemeProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: false, + ); + + /// copied from [DynamicColorBuilder] + + SystemThemeProvider call({bool highContrast = false}) => + SystemThemeProvider._(argument: highContrast, from: this); @override - bool get highContrast => (origin as SystemThemeProvider).highContrast; + String toString() => r'systemThemeProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/theme/providers/theme_from_cover_provider.g.dart b/lib/theme/providers/theme_from_cover_provider.g.dart index 1289765..844e608 100644 --- a/lib/theme/providers/theme_from_cover_provider.g.dart +++ b/lib/theme/providers/theme_from_cover_provider.g.dart @@ -6,355 +6,197 @@ part of 'theme_from_cover_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$themeFromCoverHash() => r'afdeddc4bfe2fe46a4185143d3a88a23565e33f4'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [themeFromCover]. @ProviderFor(themeFromCover) -const themeFromCoverProvider = ThemeFromCoverFamily(); +final themeFromCoverProvider = ThemeFromCoverFamily._(); -/// See also [themeFromCover]. -class ThemeFromCoverFamily extends Family>> { - /// See also [themeFromCover]. - const ThemeFromCoverFamily(); +final class ThemeFromCoverProvider + extends + $FunctionalProvider< + AsyncValue>, + FutureOr, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + ThemeFromCoverProvider._({ + required ThemeFromCoverFamily super.from, + required (ImageProvider, {Brightness brightness, bool highContrast}) + super.argument, + }) : super( + retry: null, + name: r'themeFromCoverProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [themeFromCover]. - ThemeFromCoverProvider call( - ImageProvider img, { - Brightness brightness = Brightness.dark, - bool highContrast = false, - }) { - return ThemeFromCoverProvider( - img, - brightness: brightness, - highContrast: highContrast, - ); + @override + String debugGetCreateSourceHash() => _$themeFromCoverHash(); + + @override + String toString() { + return r'themeFromCoverProvider' + '' + '$argument'; } + @$internal @override - ThemeFromCoverProvider getProviderOverride( - covariant ThemeFromCoverProvider provider, - ) { - return call( - provider.img, - brightness: provider.brightness, - highContrast: provider.highContrast, + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = + this.argument + as ( + ImageProvider, { + Brightness brightness, + bool highContrast, + }); + return themeFromCover( + ref, + argument.$1, + brightness: argument.brightness, + highContrast: argument.highContrast, ); } - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'themeFromCoverProvider'; -} - -/// See also [themeFromCover]. -class ThemeFromCoverProvider extends FutureProvider> { - /// See also [themeFromCover]. - ThemeFromCoverProvider( - ImageProvider img, { - Brightness brightness = Brightness.dark, - bool highContrast = false, - }) : this._internal( - (ref) => themeFromCover( - ref as ThemeFromCoverRef, - img, - brightness: brightness, - highContrast: highContrast, - ), - from: themeFromCoverProvider, - name: r'themeFromCoverProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$themeFromCoverHash, - dependencies: ThemeFromCoverFamily._dependencies, - allTransitiveDependencies: - ThemeFromCoverFamily._allTransitiveDependencies, - img: img, - brightness: brightness, - highContrast: highContrast, - ); - - ThemeFromCoverProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.img, - required this.brightness, - required this.highContrast, - }) : super.internal(); - - final ImageProvider img; - final Brightness brightness; - final bool highContrast; - - @override - Override overrideWith( - FutureOr> Function(ThemeFromCoverRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: ThemeFromCoverProvider._internal( - (ref) => create(ref as ThemeFromCoverRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - img: img, - brightness: brightness, - highContrast: highContrast, - ), - ); - } - - @override - FutureProviderElement> createElement() { - return _ThemeFromCoverProviderElement(this); - } - @override bool operator ==(Object other) { - return other is ThemeFromCoverProvider && - other.img == img && - other.brightness == brightness && - other.highContrast == highContrast; + return other is ThemeFromCoverProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, img.hashCode); - hash = _SystemHash.combine(hash, brightness.hashCode); - hash = _SystemHash.combine(hash, highContrast.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ThemeFromCoverRef on FutureProviderRef> { - /// The parameter `img` of this provider. - ImageProvider get img; +String _$themeFromCoverHash() => r'afdeddc4bfe2fe46a4185143d3a88a23565e33f4'; - /// The parameter `brightness` of this provider. - Brightness get brightness; +final class ThemeFromCoverFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + (ImageProvider, {Brightness brightness, bool highContrast}) + > { + ThemeFromCoverFamily._() + : super( + retry: null, + name: r'themeFromCoverProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: false, + ); - /// The parameter `highContrast` of this provider. - bool get highContrast; + ThemeFromCoverProvider call( + ImageProvider img, { + Brightness brightness = Brightness.dark, + bool highContrast = false, + }) => ThemeFromCoverProvider._( + argument: (img, brightness: brightness, highContrast: highContrast), + from: this, + ); + + @override + String toString() => r'themeFromCoverProvider'; } -class _ThemeFromCoverProviderElement - extends FutureProviderElement> - with ThemeFromCoverRef { - _ThemeFromCoverProviderElement(super.provider); +@ProviderFor(themeOfLibraryItem) +final themeOfLibraryItemProvider = ThemeOfLibraryItemFamily._(); + +final class ThemeOfLibraryItemProvider + extends + $FunctionalProvider< + AsyncValue, + ColorScheme?, + FutureOr + > + with $FutureModifier, $FutureProvider { + ThemeOfLibraryItemProvider._({ + required ThemeOfLibraryItemFamily super.from, + required (String?, {Brightness brightness, bool highContrast}) + super.argument, + }) : super( + retry: null, + name: r'themeOfLibraryItemProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - ImageProvider get img => (origin as ThemeFromCoverProvider).img; + String debugGetCreateSourceHash() => _$themeOfLibraryItemHash(); + @override - Brightness get brightness => (origin as ThemeFromCoverProvider).brightness; + String toString() { + return r'themeOfLibraryItemProvider' + '' + '$argument'; + } + + @$internal @override - bool get highContrast => (origin as ThemeFromCoverProvider).highContrast; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = + this.argument as (String?, {Brightness brightness, bool highContrast}); + return themeOfLibraryItem( + ref, + argument.$1, + brightness: argument.brightness, + highContrast: argument.highContrast, + ); + } + + @override + bool operator ==(Object other) { + return other is ThemeOfLibraryItemProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$themeOfLibraryItemHash() => r'0b2df397b2938003a9de6beb6d4204401a05370c'; -/// See also [themeOfLibraryItem]. -@ProviderFor(themeOfLibraryItem) -const themeOfLibraryItemProvider = ThemeOfLibraryItemFamily(); +final class ThemeOfLibraryItemFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (String?, {Brightness brightness, bool highContrast}) + > { + ThemeOfLibraryItemFamily._() + : super( + retry: null, + name: r'themeOfLibraryItemProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: false, + ); -/// See also [themeOfLibraryItem]. -class ThemeOfLibraryItemFamily extends Family> { - /// See also [themeOfLibraryItem]. - const ThemeOfLibraryItemFamily(); - - /// See also [themeOfLibraryItem]. ThemeOfLibraryItemProvider call( String? itemId, { Brightness brightness = Brightness.dark, bool highContrast = false, - }) { - return ThemeOfLibraryItemProvider( - itemId, - brightness: brightness, - highContrast: highContrast, - ); - } + }) => ThemeOfLibraryItemProvider._( + argument: (itemId, brightness: brightness, highContrast: highContrast), + from: this, + ); @override - ThemeOfLibraryItemProvider getProviderOverride( - covariant ThemeOfLibraryItemProvider provider, - ) { - return call( - provider.itemId, - brightness: provider.brightness, - highContrast: provider.highContrast, - ); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'themeOfLibraryItemProvider'; + String toString() => r'themeOfLibraryItemProvider'; } - -/// See also [themeOfLibraryItem]. -class ThemeOfLibraryItemProvider extends FutureProvider { - /// See also [themeOfLibraryItem]. - ThemeOfLibraryItemProvider( - String? itemId, { - Brightness brightness = Brightness.dark, - bool highContrast = false, - }) : this._internal( - (ref) => themeOfLibraryItem( - ref as ThemeOfLibraryItemRef, - itemId, - brightness: brightness, - highContrast: highContrast, - ), - from: themeOfLibraryItemProvider, - name: r'themeOfLibraryItemProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$themeOfLibraryItemHash, - dependencies: ThemeOfLibraryItemFamily._dependencies, - allTransitiveDependencies: - ThemeOfLibraryItemFamily._allTransitiveDependencies, - itemId: itemId, - brightness: brightness, - highContrast: highContrast, - ); - - ThemeOfLibraryItemProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.itemId, - required this.brightness, - required this.highContrast, - }) : super.internal(); - - final String? itemId; - final Brightness brightness; - final bool highContrast; - - @override - Override overrideWith( - FutureOr Function(ThemeOfLibraryItemRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: ThemeOfLibraryItemProvider._internal( - (ref) => create(ref as ThemeOfLibraryItemRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - itemId: itemId, - brightness: brightness, - highContrast: highContrast, - ), - ); - } - - @override - FutureProviderElement createElement() { - return _ThemeOfLibraryItemProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is ThemeOfLibraryItemProvider && - other.itemId == itemId && - other.brightness == brightness && - other.highContrast == highContrast; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, itemId.hashCode); - hash = _SystemHash.combine(hash, brightness.hashCode); - hash = _SystemHash.combine(hash, highContrast.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ThemeOfLibraryItemRef on FutureProviderRef { - /// The parameter `itemId` of this provider. - String? get itemId; - - /// The parameter `brightness` of this provider. - Brightness get brightness; - - /// The parameter `highContrast` of this provider. - bool get highContrast; -} - -class _ThemeOfLibraryItemProviderElement - extends FutureProviderElement with ThemeOfLibraryItemRef { - _ThemeOfLibraryItemProviderElement(super.provider); - - @override - String? get itemId => (origin as ThemeOfLibraryItemProvider).itemId; - @override - Brightness get brightness => - (origin as ThemeOfLibraryItemProvider).brightness; - @override - bool get highContrast => (origin as ThemeOfLibraryItemProvider).highContrast; -} -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 606c5a6..f06b290 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,7 +7,7 @@ #include "generated_plugin_registrant.h" #include -#include +#include #include #include @@ -15,9 +15,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) dynamic_color_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); - g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin"); - isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar); + g_autoptr(FlPluginRegistrar) isar_plus_flutter_libs_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "IsarPlusFlutterLibsPlugin"); + isar_plus_flutter_libs_plugin_register_with_registrar(isar_plus_flutter_libs_registrar); g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin"); media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 6023074..17405b8 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,7 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color - isar_flutter_libs + isar_plus_flutter_libs media_kit_libs_linux url_launcher_linux ) diff --git a/pubspec.lock b/pubspec.lock index f4c775c..03a42ff 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,31 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" + sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d url: "https://pub.dev" source: hosted - version: "76.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.3" + version: "91.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" + sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08 url: "https://pub.dev" source: hosted - version: "6.11.0" - analyzer_plugin: + version: "8.4.1" + analyzer_buffer: dependency: transitive description: - name: analyzer_plugin - sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" + name: analyzer_buffer + sha256: aba2f75e63b3135fd1efaa8b6abefe1aa6e41b6bd9806221620fa48f98156033 url: "https://pub.dev" source: hosted - version: "0.11.3" + version: "0.1.11" animated_list_plus: dependency: "direct main" description: @@ -138,18 +133,18 @@ packages: dependency: transitive description: name: build - sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 + sha256: c1668065e9ba04752570ad7e038288559d1e2ca5c6d0131c0f5f55e39e777413 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "4.0.3" build_config: dependency: transitive description: name: build_config - sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" build_daemon: dependency: transitive description: @@ -158,30 +153,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.4" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0 - url: "https://pub.dev" - source: hosted - version: "2.4.4" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99" + sha256: "110c56ef29b5eb367b4d17fc79375fa8c18a6cd7acd92c05bb3986c17a079057" url: "https://pub.dev" source: hosted - version: "2.4.15" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" - url: "https://pub.dev" - source: hosted - version: "8.0.0" + version: "2.10.4" built_collection: dependency: transitive description: @@ -194,10 +173,10 @@ packages: dependency: transitive description: name: built_value - sha256: "7193c909c8608d3e1a263093ff045f7140bcc1bf3f7de2c5ec7ad027891d2d22" + sha256: "426cf75afdb23aa74bd4e471704de3f9393f3c7b04c1e2d9c6f1073ae0b8b139" url: "https://pub.dev" source: hosted - version: "8.10.0" + version: "8.12.1" cached_network_image: dependency: "direct main" description: @@ -246,22 +225,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" - ci: + cli_config: dependency: transitive description: - name: ci - sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec url: "https://pub.dev" source: hosted - version: "0.1.0" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c - url: "https://pub.dev" - source: hosted - version: "0.4.2" + version: "0.2.0" clock: dependency: transitive description: @@ -302,6 +273,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" cross_file: dependency: transitive description: @@ -326,46 +305,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" - custom_lint: - dependency: "direct dev" - description: - name: custom_lint - sha256: "3486c470bb93313a9417f926c7dd694a2e349220992d7b9d14534dc49c15bba9" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - custom_lint_builder: - dependency: transitive - description: - name: custom_lint_builder - sha256: "42cdc41994eeeddab0d7a722c7093ec52bd0761921eeb2cbdbf33d192a234759" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - custom_lint_core: - dependency: transitive - description: - name: custom_lint_core - sha256: "02450c3e45e2a6e8b26c4d16687596ab3c4644dd5792e3313aa9ceba5a49b7f5" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - custom_lint_visitor: - dependency: transitive - description: - name: custom_lint_visitor - sha256: bfe9b7a09c4775a587b58d10ebb871d4fe618237639b1e84d5ec62d7dfef25f9 - url: "https://pub.dev" - source: hosted - version: "1.0.0+6.11.0" dart_style: dependency: transitive description: name: dart_style - sha256: "7306ab8a2359a48d22310ad823521d723acfed60ee1f7e37388e8986853b6820" + sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b url: "https://pub.dev" source: hosted - version: "2.3.8" + version: "3.1.3" device_info_plus: dependency: "direct main" description: @@ -511,10 +458,10 @@ packages: dependency: transitive description: name: flutter_riverpod - sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" + sha256: "38ec6c303e2c83ee84512f5fc2a82ae311531021938e63d7137eccc107bf3c02" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.1.0" flutter_settings_ui: dependency: "direct main" description: @@ -553,18 +500,18 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "44c19278dd9d89292cf46e97dc0c1e52ce03275f40a97c5a348e802a924bf40e" + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" url: "https://pub.dev" source: hosted - version: "2.5.7" + version: "3.2.3" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" url: "https://pub.dev" source: hosted - version: "2.4.4" + version: "3.1.0" frontend_server_client: dependency: transitive description: @@ -597,30 +544,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" - hive: + hive_plus_secure: dependency: "direct main" description: - name: hive - sha256: "10819524df282842ebae12870e2e0e9ebc3e5c4637bec741ad39b919c589cb20" + name: hive_plus_secure + sha256: "0bf08f07b42bc42137cfb151ee7fbe417c8295db69d13bb316d81abecfb02aed" url: "https://pub.dev" source: hosted - version: "4.0.0-dev.2" + version: "1.1.25" hooks_riverpod: dependency: "direct main" description: name: hooks_riverpod - sha256: "70bba33cfc5670c84b796e6929c54b8bc5be7d0fe15bb28c2560500b9ad06966" + sha256: b880efcd17757af0aa242e5dceac2fb781a014c22a32435a5daa8f17e9d5d8a9 url: "https://pub.dev" source: hosted - version: "2.6.1" - hotreloader: - dependency: transitive - description: - name: hotreloader - sha256: bc167a1163807b03bada490bfe2df25b0d744df359227880220a5cbd04e5734b - url: "https://pub.dev" - source: hosted - version: "4.3.0" + version: "3.1.0" http: dependency: transitive description: @@ -677,22 +616,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" - isar: + isar_plus: dependency: "direct main" description: - name: isar - sha256: ebf74d87c400bd9f7da14acb31932b50c2407edbbd40930da3a6c2a8143f85a8 + name: isar_plus + sha256: "43d874216d2f1fcec06f209ebbc75e7ca9705076d8c7077ec6ac5ea511dad9dd" url: "https://pub.dev" source: hosted - version: "4.0.0-dev.14" - isar_flutter_libs: + version: "1.2.0" + isar_plus_flutter_libs: dependency: "direct main" description: - name: isar_flutter_libs - sha256: "04a3f4035e213ddb6e78d0132a7c80296a085c2088c2a761b4a42ee5add36983" + name: isar_plus_flutter_libs + sha256: e142590a13b5c9d349555ebd72a25ee34901992a2bb32ba6ccfd414519b48adf url: "https://pub.dev" source: hosted - version: "4.0.0-dev.14" + version: "1.2.0" js: dependency: transitive description: @@ -713,10 +652,10 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c + sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 url: "https://pub.dev" source: hosted - version: "6.9.0" + version: "6.11.2" just_audio: dependency: "direct main" description: @@ -762,26 +701,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -798,6 +737,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.3" + logger: + dependency: transitive + description: + name: logger + sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3 + url: "https://pub.dev" + source: hosted + version: "2.6.2" logging: dependency: "direct main" description: @@ -822,14 +769,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.3.1" - macros: - dependency: transitive - description: - name: macros - sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" - url: "https://pub.dev" - source: hosted - version: "0.1.3-main.0" matcher: dependency: transitive description: @@ -882,10 +821,10 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mime: dependency: transitive description: @@ -903,6 +842,22 @@ packages: url: "https://github.com/Dr-Blank/miniplayer.git" source: git version: "1.0.3" + mockito: + dependency: transitive + description: + name: mockito + sha256: dac24d461418d363778d53198d9ac0510b9d073869f078450f195766ec48d05e + url: "https://pub.dev" + source: hosted + version: "5.6.1" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" numberpicker: dependency: "direct main" description: @@ -1107,42 +1062,34 @@ packages: dependency: transitive description: name: riverpod - sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + sha256: "16ff608d21e8ea64364f2b7c049c94a02ab81668f78845862b6e88b71dd4935a" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.1.0" riverpod_analyzer_utils: dependency: transitive description: name: riverpod_analyzer_utils - sha256: c6b8222b2b483cb87ae77ad147d6408f400c64f060df7a225b127f4afef4f8c8 + sha256: "947b05d04c52a546a2ac6b19ef2a54b08520ff6bdf9f23d67957a4c8df1c3bc0" url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "1.0.0-dev.8" riverpod_annotation: dependency: "direct main" description: name: riverpod_annotation - sha256: e14b0bf45b71326654e2705d462f21b958f987087be850afd60578fcd502d1b8 + sha256: cc1474bc2df55ec3c1da1989d139dcef22cd5e2bd78da382e867a69a8eca2e46 url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "4.0.0" riverpod_generator: dependency: "direct dev" description: name: riverpod_generator - sha256: "63546d70952015f0981361636bf8f356d9cfd9d7f6f0815e3c07789a41233188" + sha256: e43b1537229cc8f487f09b0c20d15dba840acbadcf5fc6dad7ad5e8ab75950dc url: "https://pub.dev" source: hosted - version: "2.6.3" - riverpod_lint: - dependency: "direct dev" - description: - name: riverpod_lint - sha256: "83e4caa337a9840469b7b9bd8c2351ce85abad80f570d84146911b32086fbd99" - url: "https://pub.dev" - source: hosted - version: "2.6.3" + version: "4.0.0+1" rxdart: dependency: transitive description: @@ -1207,6 +1154,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" shelf_web_socket: dependency: transitive description: @@ -1255,18 +1218,34 @@ packages: dependency: transitive description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + sha256: "07b277b67e0096c45196cbddddf2d8c6ffc49342e88bf31d460ce04605ddac75" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "4.1.1" source_helper: dependency: transitive description: name: source_helper - sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" url: "https://pub.dev" source: hosted - version: "1.3.5" + version: "1.3.8" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" source_span: dependency: transitive description: @@ -1379,22 +1358,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" + url: "https://pub.dev" + source: hosted + version: "1.26.3" test_api: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.4" - timing: + version: "0.7.7" + test_core: dependency: transitive description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + name: test_core + sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "0.6.12" typed_data: dependency: transitive description: @@ -1495,10 +1482,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vibration: dependency: "direct main" description: @@ -1555,6 +1542,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" win32: dependency: transitive description: @@ -1596,5 +1591,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.7.0 <4.0.0" - flutter: ">=3.32.8" + dart: ">=3.10.0 <4.0.0" + flutter: "3.38.6" diff --git a/pubspec.yaml b/pubspec.yaml index 7ccbe61..ae2b03f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,8 +19,8 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 0.0.18+9 environment: - sdk: ">=3.3.4 <4.0.0" - flutter: 3.32.8 + sdk: ">=3.10.0 <4.0.0" + flutter: 3.38.6 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -53,12 +53,12 @@ dependencies: flutter_hooks: ^0.21.2 flutter_settings_ui: ^3.0.1 font_awesome_flutter: ^10.7.0 - freezed_annotation: ^2.4.1 + freezed_annotation: ^3.1.0 go_router: ^14.0.2 - hive: ^4.0.0-dev.2 - hooks_riverpod: ^2.5.1 - isar: ^4.0.0-dev.13 - isar_flutter_libs: ^4.0.0-dev.13 + hive_plus_secure: ^1.1.25 + hooks_riverpod: ^3.0.0 + isar_plus: ^1.1.0 + isar_plus_flutter_libs: ^1.1.0 json_annotation: ^4.9.0 just_audio: ^0.9.37 just_audio_background: @@ -85,7 +85,7 @@ dependencies: path: ^1.9.0 path_provider: ^2.1.0 permission_handler: ^11.3.1 - riverpod_annotation: ^2.3.5 + riverpod_annotation: 4.0.0 scroll_loop_auto_scroll: ^0.0.5 sensors_plus: ^6.0.1 share_plus: ^10.0.2 @@ -96,14 +96,13 @@ dependencies: vibration: ^3.1.3 dev_dependencies: build_runner: ^2.4.9 - custom_lint: ^0.7.0 + # custom_lint: ^0.8.1 flutter_lints: ^5.0.0 flutter_test: sdk: flutter - freezed: ^2.5.2 + freezed: ^3.1.0 json_serializable: ^6.8.0 - riverpod_generator: ^2.4.2 - riverpod_lint: ^2.3.10 + riverpod_generator: ^4.0.0+1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/shelfsdk b/shelfsdk index e1848a4..34b2b98 160000 --- a/shelfsdk +++ b/shelfsdk @@ -1 +1 @@ -Subproject commit e1848a42c27257146015a33e9427f197f522fe03 +Subproject commit 34b2b98a90e3851f50f9657b1ff5bae5f385dbf9 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index de21556..050981d 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,7 +7,7 @@ #include "generated_plugin_registrant.h" #include -#include +#include #include #include #include @@ -16,8 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { DynamicColorPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); - IsarFlutterLibsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin")); + IsarPlusFlutterLibsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("IsarPlusFlutterLibsPlugin")); MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("MediaKitLibsWindowsAudioPluginCApi")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 13d504d..5b8e406 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,7 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color - isar_flutter_libs + isar_plus_flutter_libs media_kit_libs_windows_audio permission_handler_windows share_plus