setOverrideTitleFromMediaItem method
Given a MediaItem, set its override display title. If the title is blank, the override title is cleared.
Implementation
Future<void> setOverrideTitleFromMediaItem({
required MediaItem item,
required String? title,
}) async {
String key = getOverrideTitleKey(item);
String? value;
if (title != null) {
String trimmedTitle = title.trim();
if (trimmedTitle.isNotEmpty) {
value = trimmedTitle;
}
}
await setPreference<String?>(key: key, value: value);
}