createCustomList method

Future<TraktList> createCustomList(
  1. String id, {
  2. required String name,
  3. String? description,
  4. CustomListPrivacy privacy = CustomListPrivacy.private,
  5. bool displayNumbers = false,
  6. bool allowComments = true,
  7. CustomListSort sortBy = CustomListSort.rank,
  8. CustomListSortHow sortHow = CustomListSortHow.asc,
})

Create a new custom list.

The name is the only required field, but the other info is recommended to ask for.

id - User slug name - Name of the list. description - Description for this list. privacy - Possible values: private, friends, or public displayNumbers - Should each item be numbered? allowComments - Are comments allowed? sortBy - Possible values: rank, added, title, released, runtime, popularity, percentage, votes, my_rating, random, watched, collected sortHow - Possible values: asc, desc

🔒 OAuth Required

Implementation

Future<TraktList> createCustomList(String id,
    {required String name,
    String? description,
    CustomListPrivacy privacy = CustomListPrivacy.private,
    bool displayNumbers = false,
    bool allowComments = true,
    CustomListSort sortBy = CustomListSort.rank,
    CustomListSortHow sortHow = CustomListSortHow.asc}) async {
  Map<String, dynamic> body = {
    "name": name,
    "privacy": privacy.value,
    "display_numbers": displayNumbers,
    "allow_comments": allowComments,
    "sort_by": sortBy.value,
    "sort_how": sortHow.value
  };

  if (description != null) {
    body["description"] = description;
  }
  return await _manager._authenticatedPost<TraktList>("users/$id/lists", body: jsonEncode(body));
}