The library name is not necessary anymore [0]. Removed the same and updated the doc comments. Additionaly, added explicit types for variables as suggested by the dart linter (lints) [1][2].
[0] - https://dart.dev/tools/linter-rules/unnecessary_library_name [1] - https://dart.dev/tools/linter-rules/prefer_typing_uninitialized_variables [2] - https://dart.dev/tools/linter-rules/strict_top_level_inference Signed-off-by: Shan Shaji <[email protected]> --- lib/proxmox_dart_api_client.dart | 6 ++---- lib/src/extentions.dart | 3 ++- test/test.dart | 10 ++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/proxmox_dart_api_client.dart b/lib/proxmox_dart_api_client.dart index 9eaa257..20d76dd 100644 --- a/lib/proxmox_dart_api_client.dart +++ b/lib/proxmox_dart_api_client.dart @@ -1,7 +1,5 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library proxmox_dart_api_client; +/// Proxmox Dart API client. +library; export 'src/client.dart'; export 'src/authenticate.dart'; diff --git a/lib/src/extentions.dart b/lib/src/extentions.dart index 8b73683..2dd9352 100644 --- a/lib/src/extentions.dart +++ b/lib/src/extentions.dart @@ -10,7 +10,8 @@ extension ResponseValidation on http.Response { if (reasonPhrase != null) { message = '$statusCode: $reasonPhrase'; } - var decodedErrors; + + dynamic decodedErrors; if (extensive) { try { diff --git a/test/test.dart b/test/test.dart index 5261f7e..23368a2 100644 --- a/test/test.dart +++ b/test/test.dart @@ -3,7 +3,7 @@ import 'package:http/http.dart' as http; import 'package:proxmox_dart_api_client/src/handle_ticket_response.dart'; import 'package:test/test.dart'; -Matcher throwsProxmoxApiException(message, statusCode) => +Matcher throwsProxmoxApiException(String message, int statusCode) => throwsA(isA<ProxmoxApiException>() .having((e) => e.message, 'message ', message) .having((e) => e.statusCode, 'http status code', statusCode)); @@ -20,16 +20,14 @@ void main() { test('fail >= 400', () { var response = http.Response('', 400); - expect( - () => response.validate(false), - throwsProxmoxApiException( - 'Request failed with status 400', equals(400))); + expect(() => response.validate(false), + throwsProxmoxApiException('Request failed with status 400', 400)); }); test('fail >= 400 with reason phrase', () { var response = http.Response('', 400, reasonPhrase: 'this did not work'); expect(() => response.validate(false), - throwsProxmoxApiException('400: this did not work', equals(400))); + throwsProxmoxApiException('400: this did not work', 400)); }); test('valid credentials extraction', () { -- 2.47.3
