style: dart fix apply
This commit is contained in:
parent
1edc61edef
commit
7d70886d52
|
@ -1,7 +1,6 @@
|
|||
# github_trending
|
||||
|
||||
[![pub](https://img.shields.io/pub/v/github_trending.svg)](https://pub.dev/packages/github_trending)
|
||||
[![test](https://github.com/pd4d10/github-trending/workflows/test/badge.svg)](https://github.com/pd4d10/github-trending/actions?query=workflow:test)
|
||||
[![pub](https://img.shields.io/pub/v/github_trending.svg)](https://pub.dev/packages/github_trending) [![test](https://github.com/pd4d10/github-trending/workflows/test/badge.svg)](https://github.com/pd4d10/github-trending/actions?query=workflow:test)
|
||||
|
||||
A Dart library to get GitHub trending repositories and developers via [github-trending-api](https://github.com/huchenme/github-trending-api).
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# Defines a default set of lint rules enforced for
|
||||
# projects at Google. For details and rationale,
|
||||
# see https://github.com/dart-lang/pedantic#enabled-lints.
|
||||
include: package:pedantic/analysis_options.yaml
|
||||
# # Defines a default set of lint rules enforced for
|
||||
# # projects at Google. For details and rationale,
|
||||
# # see https://github.com/dart-lang/pedantic#enabled-lints.
|
||||
# include: package:pedantic/analysis_options.yaml
|
||||
|
||||
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
|
||||
# Uncomment to specify additional rules.
|
||||
# linter:
|
||||
# rules:
|
||||
# - camel_case_types
|
||||
# # For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
|
||||
# # Uncomment to specify additional rules.
|
||||
# # linter:
|
||||
# # rules:
|
||||
# # - camel_case_types
|
||||
|
||||
analyzer:
|
||||
# exclude:
|
||||
# - path/to/excluded/files/**
|
||||
# analyzer:
|
||||
# # exclude:
|
||||
# # - path/to/excluded/files/**
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:github_trending/src/model.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class TrendingRepositoryPrimaryLanguage {
|
||||
TrendingRepositoryPrimaryLanguage({this.name, this.color});
|
||||
String? name;
|
||||
String? color;
|
||||
TrendingRepositoryPrimaryLanguage({this.name, this.color});
|
||||
}
|
||||
|
||||
class GithubTrending {
|
||||
String prefix;
|
||||
|
||||
GithubTrending({this.prefix = 'https://ghapi.huchen.dev'});
|
||||
String prefix;
|
||||
|
||||
Future _getJson(Uri url) async {
|
||||
final res = await http.get(url);
|
||||
|
|
|
@ -4,6 +4,9 @@ part 'model.g.dart';
|
|||
|
||||
@JsonSerializable()
|
||||
class GithubTrendingRepository {
|
||||
factory GithubTrendingRepository.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingRepositoryFromJson(json);
|
||||
GithubTrendingRepository();
|
||||
String? author;
|
||||
String? name;
|
||||
String? avatar;
|
||||
|
@ -15,41 +18,38 @@ class GithubTrendingRepository {
|
|||
int? forks;
|
||||
int? currentPeriodStars;
|
||||
List<GithubTrendingRepositoryBuiltBy>? builtBy;
|
||||
GithubTrendingRepository();
|
||||
factory GithubTrendingRepository.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingRepositoryFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class GithubTrendingRepositoryBuiltBy {
|
||||
factory GithubTrendingRepositoryBuiltBy.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingRepositoryBuiltByFromJson(json);
|
||||
GithubTrendingRepositoryBuiltBy();
|
||||
String? href;
|
||||
String? avatar;
|
||||
String? username;
|
||||
GithubTrendingRepositoryBuiltBy();
|
||||
factory GithubTrendingRepositoryBuiltBy.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingRepositoryBuiltByFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class GithubTrendingDeveloper {
|
||||
factory GithubTrendingDeveloper.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingDeveloperFromJson(json);
|
||||
GithubTrendingDeveloper();
|
||||
String? username;
|
||||
String? name;
|
||||
String? type;
|
||||
String? url;
|
||||
String? avatar;
|
||||
GithubTrendingDeveloperRepository? repo;
|
||||
GithubTrendingDeveloper();
|
||||
factory GithubTrendingDeveloper.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubTrendingDeveloperFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class GithubTrendingDeveloperRepository {
|
||||
String? name;
|
||||
String? description;
|
||||
String? url;
|
||||
GithubTrendingDeveloperRepository();
|
||||
factory GithubTrendingDeveloperRepository.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubTrendingDeveloperRepositoryFromJson(json);
|
||||
GithubTrendingDeveloperRepository();
|
||||
String? name;
|
||||
String? description;
|
||||
String? url;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ dependencies:
|
|||
json_annotation: ^4.0.0
|
||||
|
||||
dev_dependencies:
|
||||
pedantic: ^1.11.0
|
||||
test: ^1.16.5
|
||||
build_runner: ^1.11.5
|
||||
json_serializable: ^4.0.2
|
||||
|
|
|
@ -26,10 +26,10 @@ void main() {
|
|||
test('star and fork count', () {
|
||||
// make sure at least one item has star or fork
|
||||
// to ensure no parse error
|
||||
var itemHasStar = items!.where((item) => item.stars != null);
|
||||
final itemHasStar = items!.where((item) => item.stars != null);
|
||||
expect(itemHasStar, isNotEmpty);
|
||||
|
||||
var itemHasFork = items!.where((item) => item.forks != null);
|
||||
final itemHasFork = items!.where((item) => item.forks != null);
|
||||
expect(itemHasFork, isNotEmpty);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue