searchTracks method
Searches for tracks matching the given query.
query: The search query string.market: An optional market (country code) to filter results.offset: The index of the first result to return.limit: The maximum number of results to return.
Returns a list of TrackModel objects.
Implementation
Future<List<TrackModel>> searchTracks(
String query, {
String? market,
int offset = 0,
int limit = 20,
}) async {
// Perform a search with the specified type (track)
final results = await search(
query,
type: [SearchType.track],
market: market,
offset: offset,
limit: limit,
);
// Filter the results to only include tracks
return results.whereType<TrackModel>().toList();
}