Eliminate deprecated usages, removed collection dependency
diff --git a/lib/src/parameters.dart b/lib/src/parameters.dart
index 61a9659..09ee5b7 100644
--- a/lib/src/parameters.dart
+++ b/lib/src/parameters.dart
@@ -4,7 +4,6 @@
import 'dart:convert';
-import 'package:collection/collection.dart';
import 'package:http_parser/http_parser.dart';
/// The type of a callback that parses parameters from an HTTP response.
@@ -25,10 +24,10 @@
}
var untypedParameters = jsonDecode(body);
- if (untypedParameters is! Map) {
- throw new FormatException(
- 'Parameters must be a map, was "$untypedParameters"');
+ if (untypedParameters is Map<String, dynamic>) {
+ return untypedParameters;
}
- return DelegatingMap.typed(untypedParameters);
+ throw new FormatException(
+ 'Parameters must be a map, was "$untypedParameters"');
}
diff --git a/pubspec.yaml b/pubspec.yaml
index dd721a6..f39e175 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -9,7 +9,6 @@
environment:
sdk: '>=2.0.0-dev.17.0 <3.0.0'
dependencies:
- collection: '^1.5.0'
http: '>=0.11.0 <0.12.0'
http_parser: '>=1.0.0 <4.0.0'
dev_dependencies:
diff --git a/test/client_test.dart b/test/client_test.dart
index c7b4bbe..ec52589 100644
--- a/test/client_test.dart
+++ b/test/client_test.dart
@@ -28,7 +28,7 @@
identifier: 'identifier', secret: 'secret', httpClient: httpClient);
expect(client.get(requestUri),
- throwsA(new isInstanceOf<oauth2.ExpirationException>()));
+ throwsA(const TypeMatcher<oauth2.ExpirationException>()));
});
test(
@@ -130,7 +130,7 @@
});
expect(client.read(requestUri),
- throwsA(new isInstanceOf<oauth2.AuthorizationException>()));
+ throwsA(const TypeMatcher<oauth2.AuthorizationException>()));
});
test('passes through a 401 response without www-authenticate', () async {
diff --git a/test/handle_access_token_response_test.dart b/test/handle_access_token_response_test.dart
index c54e54d..e4008fb 100644
--- a/test/handle_access_token_response_test.dart
+++ b/test/handle_access_token_response_test.dart
@@ -5,7 +5,6 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
-import 'package:http_parser/http_parser.dart';
import 'package:test/test.dart';
import 'package:oauth2/oauth2.dart' as oauth2;
diff --git a/test/utils.dart b/test/utils.dart
index 92835ea..64d1eb8 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -42,24 +42,10 @@
}
}
-/// A matcher for AuthorizationExceptions.
-const isAuthorizationException = const _AuthorizationException();
-
/// A matcher for functions that throw AuthorizationException.
-final Matcher throwsAuthorizationException = throwsA(isAuthorizationException);
-
-class _AuthorizationException extends TypeMatcher {
- const _AuthorizationException() : super("AuthorizationException");
- bool matches(item, Map matchState) => item is oauth2.AuthorizationException;
-}
-
-/// A matcher for ExpirationExceptions.
-const isExpirationException = const _ExpirationException();
+final Matcher throwsAuthorizationException =
+ throwsA(const TypeMatcher<oauth2.AuthorizationException>());
/// A matcher for functions that throw ExpirationException.
-final Matcher throwsExpirationException = throwsA(isExpirationException);
-
-class _ExpirationException extends TypeMatcher {
- const _ExpirationException() : super("ExpirationException");
- bool matches(item, Map matchState) => item is oauth2.ExpirationException;
-}
+final Matcher throwsExpirationException =
+ throwsA(const TypeMatcher<oauth2.ExpirationException>());