updateFile method

Future<ContentCreation> updateFile(
  1. RepositorySlug slug,
  2. String path,
  3. String message,
  4. String content,
  5. String sha, {
  6. String? branch,
})

Implementation

Future<ContentCreation> updateFile(RepositorySlug slug, String path,
    String message, String content, String sha,
    {String? branch}) async {
  ArgumentError.checkNotNull(slug);
  ArgumentError.checkNotNull(path);
  final map = createNonNullMap({
    'message': message,
    'content': content,
    'sha': sha,
    'branch': branch!,
  });
  final response = await github.request(
    'PUT',
    '/repos/${slug.fullName}/contents/$path',
    body: GitHubJson.encode(map),
  );
  return ContentCreation.fromJson(
      jsonDecode(response.body) as Map<String, dynamic>);
}