mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-27 11:51:56 +02:00
style(dart): apply repository formatting
This commit is contained in:
@@ -22,7 +22,7 @@ class ApkDownloader {
|
||||
|
||||
final client = http.Client();
|
||||
IOSink? sink;
|
||||
|
||||
|
||||
try {
|
||||
final request = http.Request('GET', uri);
|
||||
final response = await client.send(request);
|
||||
@@ -33,7 +33,7 @@ class ApkDownloader {
|
||||
}
|
||||
|
||||
final contentLength = response.contentLength ?? 0;
|
||||
|
||||
|
||||
final dir = await getExternalStorageDirectory();
|
||||
if (dir == null) {
|
||||
_log.e('Could not get storage directory');
|
||||
@@ -42,7 +42,7 @@ class ApkDownloader {
|
||||
|
||||
final filePath = '${dir.path}/SpotiFLAC-$version.apk';
|
||||
final file = File(filePath);
|
||||
|
||||
|
||||
if (await file.exists()) {
|
||||
await file.delete();
|
||||
}
|
||||
|
||||
@@ -83,9 +83,7 @@ class M3uPlaylistService {
|
||||
final track = entry.track;
|
||||
final duration = track.duration > 0 ? track.duration : -1;
|
||||
final artist = track.artistName.trim();
|
||||
final display = artist.isEmpty
|
||||
? track.name
|
||||
: '$artist - ${track.name}';
|
||||
final display = artist.isEmpty ? track.name : '$artist - ${track.name}';
|
||||
buffer
|
||||
..write('#EXTINF:')
|
||||
..write(duration)
|
||||
@@ -135,7 +133,10 @@ class M3uPlaylistService {
|
||||
}
|
||||
|
||||
/// Writes the playlist to a shareable temp file named after the playlist.
|
||||
static Future<File> writeExportFile(String playlistName, String content) async {
|
||||
static Future<File> writeExportFile(
|
||||
String playlistName,
|
||||
String content,
|
||||
) async {
|
||||
final dir = await getTemporaryDirectory();
|
||||
final safeName = playlistName
|
||||
.replaceAll(RegExp(r'[\\/:*?"<>|]'), '_')
|
||||
|
||||
@@ -477,9 +477,7 @@ class MusicPlayerHandler extends BaseAudioHandler
|
||||
if (_restoringSession) return;
|
||||
if (_media.isEmpty || _index < 0 || _index >= _media.length) {
|
||||
unawaited(
|
||||
AppStateDatabase.instance.clearPlaybackSession().catchError((
|
||||
Object e,
|
||||
) {
|
||||
AppStateDatabase.instance.clearPlaybackSession().catchError((Object e) {
|
||||
_log.w('Failed to clear playback session: $e');
|
||||
}),
|
||||
);
|
||||
@@ -798,8 +796,7 @@ class MusicPlayerHandler extends BaseAudioHandler
|
||||
}
|
||||
if (_index >= 0 && _index < _media.length - 1) {
|
||||
await _playIndex(_index + 1);
|
||||
} else if (_repeatMode == AudioServiceRepeatMode.all &&
|
||||
_media.isNotEmpty) {
|
||||
} else if (_repeatMode == AudioServiceRepeatMode.all && _media.isNotEmpty) {
|
||||
await _playIndex(0);
|
||||
} else {
|
||||
_broadcastState(playerState: PlayerState.completed);
|
||||
|
||||
@@ -83,10 +83,7 @@ class UpdateChecker {
|
||||
.timeout(const Duration(seconds: 10));
|
||||
|
||||
if (response.statusCode == 304 && cachedBody != null) {
|
||||
await prefs.setInt(
|
||||
_cachedAtKey,
|
||||
DateTime.now().millisecondsSinceEpoch,
|
||||
);
|
||||
await prefs.setInt(_cachedAtKey, DateTime.now().millisecondsSinceEpoch);
|
||||
return cachedBody;
|
||||
}
|
||||
if (response.statusCode != 200) {
|
||||
|
||||
Reference in New Issue
Block a user