list method Null safety

Stream<PullRequest> list(
  1. RepositorySlug slug,
  2. {int? pages,
  3. String? base,
  4. String direction = 'desc',
  5. String? head,
  6. String sort = 'created',
  7. String state = 'open'}
)

Fetches several pull requests.

API docs: https://developer.github.com/v3/pulls/#list-pull-requests

Implementation

Stream<PullRequest> list(
  RepositorySlug slug, {
  int? pages,
  String? base,
  String direction = 'desc',
  String? head,
  String sort = 'created',
  String state = 'open',
}) {
  final params = <String, dynamic>{};
  putValue('base', base, params);
  putValue('direction', direction, params);
  putValue('head', head, params);
  putValue('sort', sort, params);
  putValue('state', state, params);

  return PaginationHelper(github).objects(
      'GET',
      '/repos/${slug.fullName}/pulls?state=$state',
      (dynamic i) => PullRequest.fromJson(i),
      pages: pages,
      params: params);
}