RhythmBox/lib/services/audio_services/image.dart
2024-08-27 14:35:16 +08:00

22 lines
460 B
Dart

import 'package:spotify/spotify.dart';
import 'package:collection/collection.dart';
enum ImagePlaceholder {
albumArt,
artist,
collection,
online,
}
extension SpotifyImageExtensions on List<Image>? {
String? asUrlString({
int index = 1,
}) {
final sortedImage = this?.sorted((a, b) => a.width!.compareTo(b.width!));
return sortedImage?[
index > sortedImage.length - 1 ? sortedImage.length - 1 : index]
.url;
}
}