fix: resolve all dart analyze warnings
- Migrate RadioListTile to RadioGroup API (Flutter 3.32+) - Guard BuildContext usage across async gaps - Use const BorderRadius.all / EdgeInsets.all constructors - Extract nested ternaries into helpers - Prefer .first over [0], ??= over if-null assignment - Prefix unused FocusNode params with _ - Add library directive for dangling doc comments
This commit is contained in:
@@ -84,7 +84,7 @@ class LanguageCodes {
|
||||
|
||||
// Locale code (e.g. "en-US", "zh-TW")
|
||||
final parts = code.split('-');
|
||||
final langName = getLanguageName(parts[0]) ?? parts[0];
|
||||
final langName = getLanguageName(parts.first) ?? parts.first;
|
||||
final region = parts.length > 1 ? _regionNames[parts[1]] : null;
|
||||
return region != null ? '$langName ($region)' : langName;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ Future<bool?> navigateToVideoPlayer(
|
||||
bool isOffline = false,
|
||||
PlexVideoPlaybackData? playbackData,
|
||||
}) async {
|
||||
// Extract navigator before any async operations
|
||||
// Extract context-dependent values before any async operations
|
||||
final navigator = Navigator.of(context);
|
||||
final downloadProvider = context.read<DownloadProvider>();
|
||||
final client = isOffline ? null : context.getClientForMetadata(metadata);
|
||||
|
||||
// Load saved media version preference if not explicitly provided
|
||||
int mediaIndex = selectedMediaIndex ?? 0;
|
||||
@@ -75,19 +77,17 @@ Future<bool?> navigateToVideoPlayer(
|
||||
|
||||
if (isOffline) {
|
||||
// Offline mode: resolve local file path for the external player
|
||||
final downloadProvider = context.read<DownloadProvider>();
|
||||
final globalKey = '${metadata.serverId}:${metadata.ratingKey}';
|
||||
final videoPath = await downloadProvider.getVideoFilePath(globalKey);
|
||||
if (videoPath != null) {
|
||||
if (videoPath != null && context.mounted) {
|
||||
final videoUrl = videoPath.contains('://') ? videoPath : 'file://$videoPath';
|
||||
launched = await ExternalPlayerService.launch(context: context, videoUrl: videoUrl);
|
||||
}
|
||||
} else {
|
||||
final client = context.getClientForMetadata(metadata);
|
||||
} else if (context.mounted) {
|
||||
launched = await ExternalPlayerService.launch(
|
||||
context: context,
|
||||
metadata: metadata,
|
||||
client: client,
|
||||
client: client!,
|
||||
mediaIndex: mediaIndex,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user