getHiddenChannelList static method
Implementation
static Future<List<TPChannel>?> getHiddenChannelList(
TPChannel? lastChannel,
{
Function(int? errorCode, String? errorMessage)? errorCallback
}) async
{
if (!_isInitialized(errorCallback: errorCallback)) { return []; }
if (!_checkAuthInfo(errorCallback: errorCallback)) { return []; }
try {
Map<String, dynamic> queryParameters = {"type": "hidden"};
if (lastChannel != null) { queryParameters["lastChannelId"] = lastChannel.getChannelId(); }
Map<String, dynamic> response = await HttpUtil.get("/channels", queryParameters: queryParameters);
List<dynamic> channelArray = response["channels"];
List<TPChannel> list = List.from([]);
for (Map<String, dynamic> element in channelArray) {
list.add(TPChannel(element));
}
return list;
} on TPException catch(e) {
Logger.log("${e.getCode()}, ${e.getMessage()}");
errorCallback?.call(e.getCode(), e.getMessage());
} catch(e){
Logger.log("$e");
errorCallback?.call(-1, e.toString());
}
return [];
}