repo.dart

 avatar
unknown
dart
3 years ago
711 B
6
Indexable
class Repo {
  // bir repoya karşılık
  String? name;
  String? htmlUrl;
  int? stargazerCount;
  String? description;

  Repo({this.name, this.htmlUrl, this.stargazerCount, this.description});

  factory Repo.fromJson(Map<String, dynamic> json) {
    return Repo(
      name: json['name'],
      htmlUrl: json['htmlUrl'],
      stargazerCount: json['stargazerCount'],
      description: json['description'],
    );
  }
}

class All {
  List<Repo>? repos; // tüm repolar için liste

  All({this.repos});

  factory All.fromJson(List<dynamic> json) {
    List<Repo>? repos = <Repo>[];
    repos = json.map((e) => Repo.fromJson(e)).toList();
    return All(repos: repos);
  }
}
Editor is loading...