diff --git a/lib/main.dart b/lib/main.dart index d1ef3a0c..9e965c91 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1113,6 +1113,7 @@ class _SetupScreenState extends State with MountedSetStateMixin { final profileConnections = context.read(); final profileRegistry = context.read(); final activeProfiles = context.read(); + final serverManager = context.read().serverManager; final bootstrap = ConnectionBootstrap( storage: storage, connectionRegistry: connRegistry, @@ -1124,7 +1125,7 @@ class _SetupScreenState extends State with MountedSetStateMixin { profileConnections: profileConnections, connections: connRegistry, storage: storage, - serverManager: context.read().serverManager, + serverManager: serverManager, ); if (pruned > 0) { appLogger.i('Setup: pruned $pruned unreferenced Jellyfin connection${pruned == 1 ? '' : 's'}'); diff --git a/lib/mixins/paginated_item_loader.dart b/lib/mixins/paginated_item_loader.dart index 8fc13efa..ead8a9ff 100644 --- a/lib/mixins/paginated_item_loader.dart +++ b/lib/mixins/paginated_item_loader.dart @@ -47,7 +47,7 @@ mixin PaginatedItemLoader on State { /// Hook fired after each successful page merge. Default: no-op. /// Override for image prefetch, syncing a base-class `items` list, etc. - void onPageLoaded(int _, List __) {} + void onPageLoaded(int _, List _) {} /// Synchronously clear pagination state and bump the generation counter. /// Call from inside the subclass's `setState` before awaiting diff --git a/lib/profiles/active_profile_provider.dart b/lib/profiles/active_profile_provider.dart index 802ea092..e75eb35e 100644 --- a/lib/profiles/active_profile_provider.dart +++ b/lib/profiles/active_profile_provider.dart @@ -23,12 +23,7 @@ import 'profile_registry.dart'; /// local profiles first, then live home users; if neither matches we fall /// back to the first profile in the merged list. class ActiveProfileProvider extends ChangeNotifier with DisposableChangeNotifierMixin { - ActiveProfileProvider({ - required this._registry, - required this._plexHome, - required this._connections, - StorageService? storage, - }) : _storage = storage; + ActiveProfileProvider({required this._registry, required this._plexHome, required this._connections, this._storage}); final ProfileRegistry _registry; final PlexHomeService _plexHome; diff --git a/lib/profiles/plex_home_service.dart b/lib/profiles/plex_home_service.dart index a57a3fdb..0b1c7520 100644 --- a/lib/profiles/plex_home_service.dart +++ b/lib/profiles/plex_home_service.dart @@ -23,11 +23,10 @@ class PlexHomeService { PlexHomeService({ required this._connections, required this._profileConnections, - StorageService? storage, + this._storage, Future> Function(String accountToken)? plexHomeUserFetcher, this._refreshInterval = const Duration(hours: 1), - }) : _storage = storage, - _fetchHomeUsers = plexHomeUserFetcher ?? _defaultHomeUserFetcher; + }) : _fetchHomeUsers = plexHomeUserFetcher ?? _defaultHomeUserFetcher; final ConnectionRegistry _connections; final ProfileConnectionRegistry _profileConnections; diff --git a/lib/profiles/profile_connection_cleanup.dart b/lib/profiles/profile_connection_cleanup.dart index 23b5841f..eef42d44 100644 --- a/lib/profiles/profile_connection_cleanup.dart +++ b/lib/profiles/profile_connection_cleanup.dart @@ -301,11 +301,8 @@ Future _isServerReferenced( Set _serverIdsForConnection(Connection connection) { return switch (connection) { PlexAccountConnection(:final servers) => { - for (final server in servers) - if (ServerId.tryParse(server.clientIdentifier) case final serverId?) serverId, - }, - JellyfinConnection(:final serverMachineId) => { - if (ServerId.tryParse(serverMachineId) case final serverId?) serverId, + for (final server in servers) ?ServerId.tryParse(server.clientIdentifier), }, + JellyfinConnection(:final serverMachineId) => {?ServerId.tryParse(serverMachineId)}, }; } diff --git a/lib/profiles/profile_connection_registry.dart b/lib/profiles/profile_connection_registry.dart index 5b87fe14..6be45505 100644 --- a/lib/profiles/profile_connection_registry.dart +++ b/lib/profiles/profile_connection_registry.dart @@ -216,9 +216,7 @@ class ProfileConnectionRegistry { // Vault couldn't decrypt the stored token (key/ciphertext divergence). // Clear it to the empty-string lazy-fetch sentinel so the binder // re-acquires a token on next use instead of re-failing every boot. - appLogger.w( - 'ProfileConnectionRegistry: clearing undecryptable token for ${row.profileId}/${row.connectionId}', - ); + appLogger.w('ProfileConnectionRegistry: clearing undecryptable token for ${row.profileId}/${row.connectionId}'); unawaited(_clearToken(row.profileId, row.connectionId)); } return ProfileConnection( diff --git a/lib/providers/hidden_libraries_provider.dart b/lib/providers/hidden_libraries_provider.dart index 1cd2d352..4f52aac7 100644 --- a/lib/providers/hidden_libraries_provider.dart +++ b/lib/providers/hidden_libraries_provider.dart @@ -12,7 +12,7 @@ class HiddenLibrariesProvider extends ChangeNotifier with DisposableChangeNotifi bool _isInitialized = false; Future? _initFuture; - HiddenLibrariesProvider({StorageService? storageService, this.profileId}) : _storageService = storageService { + HiddenLibrariesProvider({this._storageService, this.profileId}) { // Start initialization eagerly to reduce race conditions _initFuture = _initialize(); } diff --git a/lib/providers/libraries_provider.dart b/lib/providers/libraries_provider.dart index fc08e405..ade31184 100644 --- a/lib/providers/libraries_provider.dart +++ b/lib/providers/libraries_provider.dart @@ -14,13 +14,8 @@ enum LibrariesLoadState { initial, loading, loaded, error } /// Both SideNavigationRail and LibrariesScreen consume this provider /// instead of independently fetching library data. class LibrariesProvider extends ChangeNotifier with DisposableChangeNotifierMixin { - LibrariesProvider({ - StorageService? storageService, - MultiServerProvider? multiServer, - bool Function()? isProfileBinding, - }) : _storageService = storageService, - _multiServer = multiServer, - _isProfileBinding = isProfileBinding ?? _neverBinding { + LibrariesProvider({this._storageService, this._multiServer, bool Function()? isProfileBinding}) + : _isProfileBinding = isProfileBinding ?? _neverBinding { // Reload libraries when a new server comes online. Servers bind in waves // on sign-in / profile switch and slow ones reconnect after the initial // load; without this they stay missing from the sidebar until a re-switch diff --git a/lib/providers/user_profile_provider.dart b/lib/providers/user_profile_provider.dart index 6328d203..7b356b93 100644 --- a/lib/providers/user_profile_provider.dart +++ b/lib/providers/user_profile_provider.dart @@ -33,7 +33,7 @@ import '../utils/app_logger.dart'; /// account-owner's token would silently return the *owner's* settings — /// wrong defaults for kid profiles, parental restrictions, etc. class UserProfileProvider extends ChangeNotifier with DisposableChangeNotifierMixin { - UserProfileProvider({StorageService? storageService}) : _storageService = storageService; + UserProfileProvider({this._storageService}); MediaServerUserProfile? _profileSettings; bool _isInitialized = false; diff --git a/lib/screens/libraries/folder_tree_view.dart b/lib/screens/libraries/folder_tree_view.dart index e3d61d5d..a16131b1 100644 --- a/lib/screens/libraries/folder_tree_view.dart +++ b/lib/screens/libraries/folder_tree_view.dart @@ -228,7 +228,7 @@ class FolderTreeViewState extends State { Future _handleItemTap(MediaItem item) async { final result = await navigateToMediaItem(context, item, onRefresh: widget.onRefresh); - if (!context.mounted) return; + if (!mounted) return; switch (result) { case MediaNavigationResult.unsupported: showAppSnackBar(context, t.messages.musicNotSupported); diff --git a/lib/screens/livetv/tabs/guide_tab.dart b/lib/screens/livetv/tabs/guide_tab.dart index 8add868e..390bc0bf 100644 --- a/lib/screens/livetv/tabs/guide_tab.dart +++ b/lib/screens/livetv/tabs/guide_tab.dart @@ -1112,7 +1112,7 @@ class GuideTabState extends State with MountedSetStateMixin, WidgetsBi _gridEnd = _gridStart.add(const Duration(hours: 6)); _nowWasInWindow = _nowInWindow(DateTime.now()); }); - _loadPrograms(); + unawaited(_loadPrograms()); _guideFocusNode.requestFocus(); } diff --git a/lib/screens/settings/add_jellyfin_screen.dart b/lib/screens/settings/add_jellyfin_screen.dart index b5721425..ea627731 100644 --- a/lib/screens/settings/add_jellyfin_screen.dart +++ b/lib/screens/settings/add_jellyfin_screen.dart @@ -72,10 +72,9 @@ class AddJellyfinScreen extends StatefulWidget { const AddJellyfinScreen({ super.key, this.targetProfile, - @visibleForTesting FutureOr Function()? authServiceFactory, - @visibleForTesting FutureOr> Function()? localDiscoveryFactory, - }) : _authServiceFactory = authServiceFactory, - _localDiscoveryFactory = localDiscoveryFactory; + @visibleForTesting this._authServiceFactory, + @visibleForTesting this._localDiscoveryFactory, + }); @override State createState() => _AddJellyfinScreenState(); diff --git a/lib/screens/video_player/parts/shader.dart b/lib/screens/video_player/parts/shader.dart index 4d09d9de..2f2ec96a 100644 --- a/lib/screens/video_player/parts/shader.dart +++ b/lib/screens/video_player/parts/shader.dart @@ -115,7 +115,7 @@ extension _VideoPlayerShaderMethods on VideoPlayerScreenState { if (ambientLighting.isEnabled) { await ambientLighting.disable(); - _videoFilterManager?.updateVideoFilter(); + unawaited(_videoFilterManager?.updateVideoFilter()); } else { // Get video display aspect ratio final dwidth = await player?.getProperty('dwidth'); diff --git a/lib/services/gamepad_service.dart b/lib/services/gamepad_service.dart index f2a884eb..1c62991d 100644 --- a/lib/services/gamepad_service.dart +++ b/lib/services/gamepad_service.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:ui' as ui; -import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -70,10 +69,9 @@ class GamepadDuplicateInputGuard { GamepadDuplicateInputGuard({ DateTime Function()? now, - bool Function()? enabled, + this._enabled, this.suppressionWindow = defaultSuppressionWindow, - }) : _now = now ?? DateTime.now, - _enabled = enabled; + }) : _now = now ?? DateTime.now; bool get _isEnabled => _enabled?.call() ?? true; diff --git a/lib/services/jellyfin_endpoint_discovery.dart b/lib/services/jellyfin_endpoint_discovery.dart index 7f9f2043..68e86aa2 100644 --- a/lib/services/jellyfin_endpoint_discovery.dart +++ b/lib/services/jellyfin_endpoint_discovery.dart @@ -61,8 +61,7 @@ class JellyfinEndpointUserInputCandidates { class JellyfinEndpointDiscovery { static const int defaultPort = 8096; - JellyfinEndpointDiscovery({http.Client Function()? testHttpClientFactory}) - : _testHttpClientFactory = testHttpClientFactory; + JellyfinEndpointDiscovery({this._testHttpClientFactory}); final http.Client Function()? _testHttpClientFactory; diff --git a/lib/services/system_shelf_service.dart b/lib/services/system_shelf_service.dart index 9c073e2a..b4f41ecf 100644 --- a/lib/services/system_shelf_service.dart +++ b/lib/services/system_shelf_service.dart @@ -1,6 +1,5 @@ import 'dart:io' show Platform; -import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import '../media/ids.dart'; diff --git a/lib/widgets/app_menu.dart b/lib/widgets/app_menu.dart index 9311ae61..502258e1 100644 --- a/lib/widgets/app_menu.dart +++ b/lib/widgets/app_menu.dart @@ -3,7 +3,6 @@ import 'dart:math' as math; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:material_symbols_icons/symbols.dart'; import '../focus/dpad_navigator.dart'; diff --git a/lib/widgets/video_controls/player_chrome_controller.dart b/lib/widgets/video_controls/player_chrome_controller.dart index 5fa7a46c..75b5a8f5 100644 --- a/lib/widgets/video_controls/player_chrome_controller.dart +++ b/lib/widgets/video_controls/player_chrome_controller.dart @@ -12,7 +12,7 @@ enum PlayerChromeFocusTarget { playPause, timeline } /// Owns video-player chrome visibility and auto-hide policy for one player route. class PlayerChromeController extends ChangeNotifier implements ValueListenable { - PlayerChromeController({bool controlsVisible = true}) : _controlsVisible = controlsVisible; + PlayerChromeController({this._controlsVisible = true}); bool _controlsVisible; bool _contentStripVisible = false;