style: apply analyzer lint fixes across lib

Initializing formals, unawaited() on fire-and-forget futures, unused
import removal, wildcard params, and mounted vs context.mounted.
This commit is contained in:
edde746
2026-07-06 15:56:56 +02:00
parent 49d4b433a7
commit ef75887504
18 changed files with 23 additions and 44 deletions
+2 -1
View File
@@ -1113,6 +1113,7 @@ class _SetupScreenState extends State<SetupScreen> with MountedSetStateMixin {
final profileConnections = context.read<ProfileConnectionRegistry>();
final profileRegistry = context.read<ProfileRegistry>();
final activeProfiles = context.read<ActiveProfileProvider>();
final serverManager = context.read<MultiServerProvider>().serverManager;
final bootstrap = ConnectionBootstrap(
storage: storage,
connectionRegistry: connRegistry,
@@ -1124,7 +1125,7 @@ class _SetupScreenState extends State<SetupScreen> with MountedSetStateMixin {
profileConnections: profileConnections,
connections: connRegistry,
storage: storage,
serverManager: context.read<MultiServerProvider>().serverManager,
serverManager: serverManager,
);
if (pruned > 0) {
appLogger.i('Setup: pruned $pruned unreferenced Jellyfin connection${pruned == 1 ? '' : 's'}');
+1 -1
View File
@@ -47,7 +47,7 @@ mixin PaginatedItemLoader<T, W extends StatefulWidget> on State<W> {
/// 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<T> __) {}
void onPageLoaded(int _, List<T> _) {}
/// Synchronously clear pagination state and bump the generation counter.
/// Call from inside the subclass's `setState` before awaiting
+1 -6
View File
@@ -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;
+2 -3
View File
@@ -23,11 +23,10 @@ class PlexHomeService {
PlexHomeService({
required this._connections,
required this._profileConnections,
StorageService? storage,
this._storage,
Future<List<PlexHomeUser>> Function(String accountToken)? plexHomeUserFetcher,
this._refreshInterval = const Duration(hours: 1),
}) : _storage = storage,
_fetchHomeUsers = plexHomeUserFetcher ?? _defaultHomeUserFetcher;
}) : _fetchHomeUsers = plexHomeUserFetcher ?? _defaultHomeUserFetcher;
final ConnectionRegistry _connections;
final ProfileConnectionRegistry _profileConnections;
+2 -5
View File
@@ -301,11 +301,8 @@ Future<bool> _isServerReferenced(
Set<ServerId> _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)},
};
}
@@ -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(
+1 -1
View File
@@ -12,7 +12,7 @@ class HiddenLibrariesProvider extends ChangeNotifier with DisposableChangeNotifi
bool _isInitialized = false;
Future<void>? _initFuture;
HiddenLibrariesProvider({StorageService? storageService, this.profileId}) : _storageService = storageService {
HiddenLibrariesProvider({this._storageService, this.profileId}) {
// Start initialization eagerly to reduce race conditions
_initFuture = _initialize();
}
+2 -7
View File
@@ -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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -228,7 +228,7 @@ class FolderTreeViewState extends State<FolderTreeView> {
Future<void> _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);
+1 -1
View File
@@ -1112,7 +1112,7 @@ class GuideTabState extends State<GuideTab> with MountedSetStateMixin, WidgetsBi
_gridEnd = _gridStart.add(const Duration(hours: 6));
_nowWasInWindow = _nowInWindow(DateTime.now());
});
_loadPrograms();
unawaited(_loadPrograms());
_guideFocusNode.requestFocus();
}
@@ -72,10 +72,9 @@ class AddJellyfinScreen extends StatefulWidget {
const AddJellyfinScreen({
super.key,
this.targetProfile,
@visibleForTesting FutureOr<JellyfinConnectionAuthService> Function()? authServiceFactory,
@visibleForTesting FutureOr<List<DiscoveredJellyfinServer>> Function()? localDiscoveryFactory,
}) : _authServiceFactory = authServiceFactory,
_localDiscoveryFactory = localDiscoveryFactory;
@visibleForTesting this._authServiceFactory,
@visibleForTesting this._localDiscoveryFactory,
});
@override
State<AddJellyfinScreen> createState() => _AddJellyfinScreenState();
+1 -1
View File
@@ -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');
+2 -4
View File
@@ -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;
@@ -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;
-1
View File
@@ -1,6 +1,5 @@
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import '../media/ids.dart';
-1
View File
@@ -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';
@@ -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<bool> {
PlayerChromeController({bool controlsVisible = true}) : _controlsVisible = controlsVisible;
PlayerChromeController({this._controlsVisible = true});
bool _controlsVisible;
bool _contentStripVisible = false;