create method

Future<TwitterList> create({
  1. String? name,
  2. String? mode,
  3. String? description,
  4. TransformResponse<TwitterList> transform = defaultTwitterListTransform,
})

Creates a new list for the authenticated user. Note that you can create up to 1000 lists per account.

name The name for the list. A list's name must start with a letter and can consist only of 25 or fewer letters, numbers, "-", or "_" characters.

mode Whether your list is public or private. Values can be public or private . If no mode is specified the list will be public.

description The description to give the list.

transform Can be used to parse the request. By default, the response is parsed in an isolate.

See https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-create.

Implementation

Future<TwitterList> create({
  String? name,
  String? mode,
  String? description,
  TransformResponse<TwitterList> transform = defaultTwitterListTransform,
}) async {
  final body = <String, String>{}
    ..addParameter('name', name)
    ..addParameter('mode', mode)
    ..addParameter('description', description);

  return client
      .post(Uri.https('api.twitter.com', '1.1/lists/create.json'), body: body)
      .then(transform);
}