diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 5fb5a1c7..2d725e23 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [ubuntu-latest] # Test with at least the declared minimum Dart version - sdk: [2.18.7, stable] + sdk: ['3.0', stable] steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9665e6e4..ea5c0870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.23.0 + +* Require Dart 3.0. +* Update to the latest `package:lints`. + ## 9.22.0 * Add support for the `Ghost` user when the Github user is deleted. diff --git a/analysis_options.yaml b/analysis_options.yaml index f7a9ff49..1af8628e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -15,8 +15,6 @@ linter: - avoid_implementing_value_types - avoid_js_rounded_ints - avoid_private_typedef_functions - - avoid_returning_null - - avoid_returning_null_for_future - avoid_returning_this - avoid_setters_without_getters - avoid_slow_async_io diff --git a/lib/src/common.dart b/lib/src/common.dart index 8ec0f7ae..df783a26 100644 --- a/lib/src/common.dart +++ b/lib/src/common.dart @@ -1,5 +1,7 @@ /// The Core of GitHub for Dart. /// Contains the Models and other GitHub stuff. +library; + export 'package:github/src/common/activity_service.dart'; export 'package:github/src/common/authorizations_service.dart'; export 'package:github/src/common/checks_service.dart'; diff --git a/lib/src/common/activity_service.dart b/lib/src/common/activity_service.dart index 0001fcdc..f69e8c49 100644 --- a/lib/src/common/activity_service.dart +++ b/lib/src/common/activity_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/activity/ class ActivityService extends Service { - ActivityService(GitHub github) : super(github); + ActivityService(super.github); /// Lists public events. /// diff --git a/lib/src/common/authorizations_service.dart b/lib/src/common/authorizations_service.dart index 3cbe6ef0..68b80c25 100644 --- a/lib/src/common/authorizations_service.dart +++ b/lib/src/common/authorizations_service.dart @@ -10,7 +10,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/oauth_authorizations/ class AuthorizationsService extends Service { - AuthorizationsService(GitHub github) : super(github); + AuthorizationsService(super.github); /// Lists all authorizations. /// diff --git a/lib/src/common/checks_service.dart b/lib/src/common/checks_service.dart index 0e87f4d2..f3085197 100644 --- a/lib/src/common/checks_service.dart +++ b/lib/src/common/checks_service.dart @@ -18,14 +18,13 @@ class ChecksService extends Service { /// API docs: https://developer.github.com/v3/checks/suites/ final CheckSuitesService checkSuites; - ChecksService(GitHub github) + ChecksService(super.github) : checkRuns = CheckRunsService._(github), - checkSuites = CheckSuitesService._(github), - super(github); + checkSuites = CheckSuitesService._(github); } class CheckRunsService extends Service { - CheckRunsService._(GitHub github) : super(github); + CheckRunsService._(super.github); /// Creates a new check run for a specific commit in a repository. /// Your GitHub App must have the `checks:write` permission to create check runs. @@ -235,7 +234,7 @@ class CheckRunsService extends Service { } class CheckSuitesService extends Service { - CheckSuitesService._(GitHub github) : super(github); + CheckSuitesService._(super.github); /// Gets a single check suite using its `id`. /// GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get check suites. diff --git a/lib/src/common/gists_service.dart b/lib/src/common/gists_service.dart index 9078e03d..05ac62bd 100644 --- a/lib/src/common/gists_service.dart +++ b/lib/src/common/gists_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/gists/ class GistsService extends Service { - GistsService(GitHub github) : super(github); + GistsService(super.github); /// lists gists for a user. /// diff --git a/lib/src/common/git_service.dart b/lib/src/common/git_service.dart index 7052e4f6..338dbeba 100644 --- a/lib/src/common/git_service.dart +++ b/lib/src/common/git_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/git/blobs/ class GitService extends Service { - const GitService(GitHub github) : super(github); + const GitService(super.github); /// Fetches a blob from [slug] for a given [sha]. /// diff --git a/lib/src/common/issues_service.dart b/lib/src/common/issues_service.dart index 243c81dd..ed061846 100644 --- a/lib/src/common/issues_service.dart +++ b/lib/src/common/issues_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/issues/ class IssuesService extends Service { - IssuesService(GitHub github) : super(github); + IssuesService(super.github); /// List all issues across all the authenticated user’s visible repositories /// including owned repositories, member repositories, and organization repositories diff --git a/lib/src/common/misc_service.dart b/lib/src/common/misc_service.dart index bb351f3d..30385a18 100644 --- a/lib/src/common/misc_service.dart +++ b/lib/src/common/misc_service.dart @@ -7,7 +7,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/misc/ class MiscService extends Service { - MiscService(GitHub github) : super(github); + MiscService(super.github); /// Fetches all emojis available on GitHub /// Returns a map of the name to a url of the image. diff --git a/lib/src/common/model/checks.dart b/lib/src/common/model/checks.dart index 9d7d6e21..5068febc 100644 --- a/lib/src/common/model/checks.dart +++ b/lib/src/common/model/checks.dart @@ -9,7 +9,7 @@ class CheckRunAnnotationLevel extends EnumWithValue { static const warning = CheckRunAnnotationLevel._('warning'); static const failure = CheckRunAnnotationLevel._('failure'); - const CheckRunAnnotationLevel._(String value) : super(value); + const CheckRunAnnotationLevel._(String super.value); factory CheckRunAnnotationLevel._fromValue(String? value) { switch (value) { @@ -51,7 +51,7 @@ class CheckRunConclusion extends EnumWithValue { static const actionRequired = CheckRunConclusion._('action_required'); static const empty = CheckRunConclusion._(null); - const CheckRunConclusion._(String? value) : super(value); + const CheckRunConclusion._(super.value); factory CheckRunConclusion._fromValue(String? value) { if (value == null) { @@ -79,13 +79,13 @@ class CheckRunStatus extends EnumWithValue { static const queued = CheckRunStatus._('queued'); static const inProgress = CheckRunStatus._('in_progress'); static const completed = CheckRunStatus._('completed'); - const CheckRunStatus._(String value) : super(value); + const CheckRunStatus._(String super.value); } class CheckRunFilter extends EnumWithValue { static const all = CheckRunFilter._('all'); static const latest = CheckRunFilter._('latest'); - const CheckRunFilter._(String value) : super(value); + const CheckRunFilter._(String super.value); } @immutable @@ -253,7 +253,7 @@ class CheckRunAnnotation { assert(title.length <= 255); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { if (other is CheckRunAnnotation) { return other.annotationLevel == annotationLevel && other.path == path && diff --git a/lib/src/common/orgs_service.dart b/lib/src/common/orgs_service.dart index d793a8b9..b2ca7b26 100644 --- a/lib/src/common/orgs_service.dart +++ b/lib/src/common/orgs_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/orgs/ class OrganizationsService extends Service { - OrganizationsService(GitHub github) : super(github); + OrganizationsService(super.github); /// Lists all of the memberships in organizations for the given [userName]. /// If [userName] is not specified we list the memberships in organizations diff --git a/lib/src/common/pulls_service.dart b/lib/src/common/pulls_service.dart index 5242f0e3..7fee2bf9 100644 --- a/lib/src/common/pulls_service.dart +++ b/lib/src/common/pulls_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/pulls/ class PullRequestsService extends Service { - PullRequestsService(GitHub github) : super(github); + PullRequestsService(super.github); /// Fetches several pull requests. /// diff --git a/lib/src/common/repos_service.dart b/lib/src/common/repos_service.dart index a274710e..83fa5ef0 100644 --- a/lib/src/common/repos_service.dart +++ b/lib/src/common/repos_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/repos/ class RepositoriesService extends Service { - RepositoriesService(GitHub github) : super(github); + RepositoriesService(super.github); /// Lists the repositories of the currently authenticated user. /// diff --git a/lib/src/common/search_service.dart b/lib/src/common/search_service.dart index bf2b41ec..27cf6eef 100644 --- a/lib/src/common/search_service.dart +++ b/lib/src/common/search_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/search/ class SearchService extends Service { - SearchService(GitHub github) : super(github); + SearchService(super.github); /// Search for repositories using [query]. /// Since the Search Rate Limit is small, this is a best effort implementation. diff --git a/lib/src/common/url_shortener_service.dart b/lib/src/common/url_shortener_service.dart index 0b1e296f..60db2958 100644 --- a/lib/src/common/url_shortener_service.dart +++ b/lib/src/common/url_shortener_service.dart @@ -6,7 +6,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://github.com/blog/985-git-io-github-url-shortener class UrlShortenerService extends Service { - UrlShortenerService(GitHub github) : super(github); + UrlShortenerService(super.github); /// Shortens the provided [url]. An optional [code] can be provided to create /// your own vanity URL. diff --git a/lib/src/common/users_service.dart b/lib/src/common/users_service.dart index bb27ff6d..6485f4b0 100644 --- a/lib/src/common/users_service.dart +++ b/lib/src/common/users_service.dart @@ -8,7 +8,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/users/ class UsersService extends Service { - UsersService(GitHub github) : super(github); + UsersService(super.github); /// Fetches the user specified by [name]. /// diff --git a/lib/src/common/util/errors.dart b/lib/src/common/util/errors.dart index 81fa72b2..14625a6c 100644 --- a/lib/src/common/util/errors.dart +++ b/lib/src/common/util/errors.dart @@ -25,14 +25,13 @@ class NotReady extends GitHubError { /// GitHub Entity was not found class NotFound extends GitHubError { const NotFound( - GitHub github, - String msg, - ) : super(github, msg); + super.github, + String super.msg, + ); } class BadRequest extends GitHubError { - const BadRequest(GitHub github, [String? msg = 'Not Found']) - : super(github, msg); + const BadRequest(super.github, [super.msg = 'Not Found']); } /// GitHub Repository was not found @@ -94,11 +93,10 @@ class NotAuthenticated extends GitHubError { } class InvalidJSON extends BadRequest { - const InvalidJSON(GitHub github, [String? message = 'Invalid JSON']) - : super(github, message); + const InvalidJSON(super.github, [super.message = 'Invalid JSON']); } class ValidationFailed extends GitHubError { - const ValidationFailed(GitHub github, [String message = 'Validation Failed']) - : super(github, message); + const ValidationFailed(super.github, + [String super.message = 'Validation Failed']); } diff --git a/lib/src/common/util/utils.dart b/lib/src/common/util/utils.dart index 57bd6712..5c690774 100644 --- a/lib/src/common/util/utils.dart +++ b/lib/src/common/util/utils.dart @@ -21,7 +21,7 @@ abstract class EnumWithValue { /// True iff [other] is an [EnumWithValue] with the same value as this object. @override - bool operator ==(dynamic other) => + bool operator ==(Object other) => other is EnumWithValue && value == other.value; @override diff --git a/pubspec.yaml b/pubspec.yaml index af2ff765..308c3631 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: github -version: 9.22.0 +version: 9.23.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ^3.0.0 dependencies: http: '>=0.13.0 <2.0.0' @@ -19,10 +19,10 @@ dev_dependencies: collection: ^1.15.0 dependency_validator: json_serializable: ^6.6.1 - lints: ^2.0.0 + lints: ^3.0.0 mockito: ^5.0.0 nock: ^1.0.0 pub_semver: ^2.0.0 test: ^1.16.0 yaml: ^3.0.0 - yaml_edit: + yaml_edit: ^2.2.0 diff --git a/test/helper/http.dart b/test/helper/http.dart index 2c5eaab4..ffed40d4 100644 --- a/test/helper/http.dart +++ b/test/helper/http.dart @@ -25,8 +25,8 @@ class MockHTTPClient extends http.BaseClient { } class MockResponse extends http.Response { - MockResponse(String body, Map headers, int statusCode) - : super(body, statusCode, headers: headers); + MockResponse(super.body, Map headers, super.statusCode) + : super(headers: headers); factory MockResponse.fromAsset(String name) { final responseData = diff --git a/test/server/hooks_test_data.dart b/test/server/hooks_test_data.dart index 4f5b734b..ad02cc10 100644 --- a/test/server/hooks_test_data.dart +++ b/test/server/hooks_test_data.dart @@ -1,4 +1,5 @@ /// Json messages as dart string used for checks model tests. +library; String checkSuiteString = checkSuiteTemplate('requested'); diff --git a/tool/process_github_schema.dart b/tool/process_github_schema.dart index e3850df5..14994289 100644 --- a/tool/process_github_schema.dart +++ b/tool/process_github_schema.dart @@ -20,7 +20,7 @@ List wordWrap(String body) { typedef GenTypeVisitor = void Function(GenType type); -abstract class GenType extends Comparable { +abstract class GenType implements Comparable { GenType(); String get name;