historyItem method
A single history entry by its numeric history id.
Wraps GET /status/sessions/history/{historyId}. historyId is the
numeric history identifier (the historyKey field is its full key
path); pass it as a String or int — Plex accepts the numeric id
either way, mirroring how deleteHistoryEntry deals in keys. Returns
the first Metadata entry, or null when no matching entry exists.
Implementation
Future<Map<String, dynamic>?> historyItem(Object historyId) async {
final res = await _http.request<Map<String, dynamic>>(
'/status/sessions/history/$historyId',
);
final container = res.data?['MediaContainer'];
if (container is! Map<String, dynamic>) return null;
final list = container['Metadata'];
if (list is! List || list.isEmpty) return null;
final first = list.first;
return first is Map<String, dynamic> ? first : null;
}