editGist method

Future<Gist> editGist(
  1. String id, {
  2. String? description,
  3. Map<String, String>? files,
})

Implementation

Future<Gist> editGist(
  String id, {
  String? description,
  Map<String, String>? files,
}) {
  final map = <String, dynamic>{};

  if (description != null) {
    map['description'] = description;
  }

  if (files != null) {
    final f = <String, dynamic>{};
    for (final key in files.keys) {
      f[key] = files[key] == null ? null : {'content': files[key]};
    }
    map['files'] = f;
  }

  return github.postJSON(
    '/gists/$id',
    statusCode: 200,
    body: GitHubJson.encode(map),
    convert: (dynamic i) => Gist.fromJson(i),
  );
}