getChannels method

Future<List<Channel>> getChannels(
  1. [ChannelFilter filter = const ChannelFilter(limit: 25, offset: 0, order: Order.ascending, sort: [ChannelSort.organization])]
)

Get channels

Arguments:

  • filter Filter the results returns by the API

Implementation

Future<List<Channel>> getChannels([
  ChannelFilter filter = const ChannelFilter(
    limit: 25,
    offset: 0,
    order: Order.ascending,
    sort: [ChannelSort.organization],
  ),
]) async {
  final Map<String, dynamic> params = filter.toJson();
  final response =
      await getEndpoint(HolodexEndpoint.channels, params: params);
  final List<dynamic> list = jsonDecode(response.body);

  return list.map((channel) => Channel.fromJson(channel)).toList();
}