getNewsFeeds static method
Future<List<NewsFeedEntry> >
getNewsFeeds({
- required int limit,
- int? offsetID,
- required NewsFeedCampaignType campaignType,
Get a list of news feeds.
Implementation
static Future<List<NewsFeedEntry>> getNewsFeeds({
required final int limit,
final int? offsetID,
required final NewsFeedCampaignType campaignType}) async
{
if (limit < 1) {
throw new ArgumentError("getNewsFeeds: `limit` must be a positive value.");
}
if (offsetID != null && offsetID < 1) {
throw new ArgumentError("getNewsFeeds: `offsetID` must be a positive value or null.");
}
if (campaignType == NewsFeedCampaignType.Unknown) {
throw new ArgumentError("getNewsFeeds: Invalid value was set for `campaignType`.");
}
// int will be converted to Integer or NSNumber.
var newsFeeds = await _invokeListMethod<Map>('getNewsFeeds', [limit, offsetID, DartNewsFeedUtils.convertCampaignTypeToString(campaignType)]);
var list = <NewsFeedEntry>[];
if (newsFeeds != null && newsFeeds.length > 0) {
for (var newsFeed in newsFeeds) {
var map = Map<String, String?>.from(newsFeed); // Convert Map<dynamic, dynamic> to Map<String, String>
list.add(NewsFeedEntry(map));
}
}
return list;
}