enable pedantic lints
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a10d4c5..108d105 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,2 +1 @@
-analyzer:
- strong-mode: true
+include: package:pedantic/analysis_options.yaml
diff --git a/lib/src/authorization_code_grant.dart b/lib/src/authorization_code_grant.dart
index bacb680..6b28290 100644
--- a/lib/src/authorization_code_grant.dart
+++ b/lib/src/authorization_code_grant.dart
@@ -124,7 +124,7 @@
this.identifier, this.authorizationEndpoint, this.tokenEndpoint,
{this.secret,
String delimiter,
- bool basicAuth: true,
+ bool basicAuth = true,
http.Client httpClient,
Map<String, dynamic> getParameters(MediaType contentType, String body)})
: _basicAuth = basicAuth,
@@ -174,7 +174,7 @@
};
if (state != null) parameters['state'] = state;
- if (!scopes.isEmpty) parameters['scope'] = scopes.join(_delimiter);
+ if (scopes.isNotEmpty) parameters['scope'] = scopes.join(_delimiter);
return addQueryParameters(this.authorizationEndpoint, parameters);
}
diff --git a/lib/src/client.dart b/lib/src/client.dart
index 865b946..367d583 100644
--- a/lib/src/client.dart
+++ b/lib/src/client.dart
@@ -86,7 +86,7 @@
Client(this._credentials,
{this.identifier,
this.secret,
- bool basicAuth: true,
+ bool basicAuth = true,
http.Client httpClient})
: _basicAuth = basicAuth,
_httpClient = httpClient == null ? new http.Client() : httpClient {
diff --git a/lib/src/credentials.dart b/lib/src/credentials.dart
index f40b26d..343f12d 100644
--- a/lib/src/credentials.dart
+++ b/lib/src/credentials.dart
@@ -190,7 +190,7 @@
{String identifier,
String secret,
Iterable<String> newScopes,
- bool basicAuth: true,
+ bool basicAuth = true,
http.Client httpClient}) async {
var scopes = this.scopes;
if (newScopes != null) scopes = newScopes.toList();
@@ -213,7 +213,7 @@
var headers = <String, String>{};
var body = {"grant_type": "refresh_token", "refresh_token": refreshToken};
- if (!scopes.isEmpty) body["scope"] = scopes.join(_delimiter);
+ if (scopes.isNotEmpty) body["scope"] = scopes.join(_delimiter);
if (basicAuth && secret != null) {
headers["Authorization"] = basicAuthHeader(identifier, secret);
diff --git a/lib/src/handle_access_token_response.dart b/lib/src/handle_access_token_response.dart
index 84fac67..ca4896e 100644
--- a/lib/src/handle_access_token_response.dart
+++ b/lib/src/handle_access_token_response.dart
@@ -106,7 +106,7 @@
// off-spec.
if (response.statusCode != 400 && response.statusCode != 401) {
var reason = '';
- if (response.reasonPhrase != null && !response.reasonPhrase.isEmpty) {
+ if (response.reasonPhrase != null && response.reasonPhrase.isNotEmpty) {
' ${response.reasonPhrase}';
}
throw new FormatException('OAuth request for "$tokenEndpoint" failed '
diff --git a/lib/src/resource_owner_password_grant.dart b/lib/src/resource_owner_password_grant.dart
index ebd1d12..13d8f28 100644
--- a/lib/src/resource_owner_password_grant.dart
+++ b/lib/src/resource_owner_password_grant.dart
@@ -48,7 +48,7 @@
{String identifier,
String secret,
Iterable<String> scopes,
- bool basicAuth: true,
+ bool basicAuth = true,
http.Client httpClient,
String delimiter,
Map<String, dynamic> getParameters(
@@ -73,7 +73,8 @@
}
}
- if (scopes != null && !scopes.isEmpty) body['scope'] = scopes.join(delimiter);
+ if (scopes != null && scopes.isNotEmpty)
+ body['scope'] = scopes.join(delimiter);
if (httpClient == null) httpClient = new http.Client();
var response = await httpClient.post(authorizationEndpoint,
diff --git a/pubspec.yaml b/pubspec.yaml
index f39e175..915622b 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -12,4 +12,5 @@
http: '>=0.11.0 <0.12.0'
http_parser: '>=1.0.0 <4.0.0'
dev_dependencies:
+ pedantic: ^1.2.0
test: ^1.0.0
diff --git a/test/handle_access_token_response_test.dart b/test/handle_access_token_response_test.dart
index e4008fb..fd4b1a7 100644
--- a/test/handle_access_token_response_test.dart
+++ b/test/handle_access_token_response_test.dart
@@ -26,9 +26,9 @@
void main() {
group('an error response', () {
oauth2.Credentials handleError(
- {String body: '{"error": "invalid_request"}',
- int statusCode: 400,
- Map<String, String> headers: const {
+ {String body = '{"error": "invalid_request"}',
+ int statusCode = 400,
+ Map<String, String> headers = const {
"content-type": "application/json"
}}) =>
handle(new http.Response(body, statusCode, headers: headers));
@@ -115,9 +115,9 @@
group('a success response', () {
oauth2.Credentials handleSuccess(
- {String contentType: "application/json",
- accessToken: 'access token',
- tokenType: 'bearer',
+ {String contentType = "application/json",
+ accessToken = 'access token',
+ tokenType = 'bearer',
expiresIn,
refreshToken,
scope}) {