getGitignoreTemplates method

Future<GitignoreTemplates> getGitignoreTemplates({
  1. String? tokenGithub,
})

Implementation

Future<scheme.GitignoreTemplates> getGitignoreTemplates({
  String? tokenGithub,
}) async {
  GitHub gitHub = git_hub(
    tokenGithub: tokenGithub,
  );
  List<String> git_ignore_templates =
      ((await gitHub.getJSON('/gitignore/templates')) as List)
          .whereType<String>()
          .toList();

  Map jsonData = {
    "@type": "gitignoreTemplates",
    "total_count": git_ignore_templates.length,
    "git_ignore_templates": git_ignore_templates,
  };

  return scheme.GitignoreTemplates(jsonData);
}