createReference method Null safety

Future<GitReference> createReference(
  1. RepositorySlug slug,
  2. String ref,
  3. String? sha
)

Creates a new reference in a repository.

The ref is the name of the fully qualified reference (ie: refs/heads/master).

API docs: https://developer.github.com/v3/git/refs/#create-a-reference

Implementation

Future<GitReference> createReference(
    RepositorySlug slug, String ref, String? sha) {
  return github.postJSON('/repos/${slug.fullName}/git/refs',
      convert: (dynamic i) => GitReference.fromJson(i),
      statusCode: StatusCodes.CREATED,
      body: GitHubJson.encode({'ref': ref, 'sha': sha}));
}