getTree method Null safety

Future<GitTree> getTree(
  1. RepositorySlug slug,
  2. String? sha,
  3. {bool recursive = false}

Fetches a tree from a repository for the given ref sha.

If recursive is set to true, the tree is fetched recursively.

API docs: and


Future<GitTree> getTree(RepositorySlug slug, String? sha,
    {bool recursive = false}) {
  var path = '/repos/${slug.fullName}/git/trees/$sha';
  if (recursive) {
    path += '?recursive=1';

  return github.getJSON(path,
      convert: (dynamic j) => GitTree.fromJson(j),
      statusCode: StatusCodes.OK);