From 6d205667e91dbf2f6f19e31b35cfe746b9c5cdfb Mon Sep 17 00:00:00 2001 From: Harpreet Sangar Date: Thu, 23 Jan 2025 11:17:44 +0530 Subject: [PATCH] Fix dart analyze issues. --- CHANGELOG.md | 7 +- README.md | 2 +- analysis_options.yaml | 2 +- example/console-simple/pubspec.lock | 78 ++++++++----------- example/console-simple/pubspec.yaml | 6 +- lib/src/exceptions/exceptions.dart | 2 - .../request_exceptions/http_error.dart | 2 +- .../request_exceptions/server_error.dart | 2 +- lib/src/models/field.dart | 3 - lib/src/models/models.dart | 2 - lib/src/models/schema.dart | 2 +- lib/src/services/api_call.dart | 6 +- lib/src/services/collections_api_call.dart | 5 +- lib/src/services/documents_api_call.dart | 5 +- lib/typesense.dart | 2 - pubspec.yaml | 18 ++--- test/test_utils.dart | 11 +-- 17 files changed, 61 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7113309..a41d7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.5.2 + +* Fixed dart analyze issues. +* Updated dependencies. + # 0.5.1 * Added `reference` property in `Field` class. @@ -5,7 +10,7 @@ # 0.5.0 * Added support for nested object fields. -* Updated dependencies.cd +* Updated dependencies. # 0.4.0 diff --git a/README.md b/README.md index 28d2806..cd85164 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add `typesense` as a [dependency in your pubspec.yaml file](https://flutter.dev/ ```@yaml dependencies: - typesense: ^0.5.1 + typesense: ^0.5.2 ``` ## Usage diff --git a/analysis_options.yaml b/analysis_options.yaml index c36c2c5..572dd23 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1 @@ -include: package:lints/core.yaml +include: package:lints/recommended.yaml diff --git a/example/console-simple/pubspec.lock b/example/console-simple/pubspec.lock index 73d9051..ade86bd 100644 --- a/example/console-simple/pubspec.lock +++ b/example/console-simple/pubspec.lock @@ -5,136 +5,120 @@ packages: dependency: transitive description: name: async - sha256: db4766341bd8ecb66556f31ab891a5d596ef829221993531bd64a8e6342f0cda + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.8.2" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.dev" - source: hosted - version: "1.3.1" + version: "2.12.0" collection: dependency: transitive description: name: collection - sha256: "6d4193120997ecfd09acf0e313f13dc122b119e5eca87ef57a7d065ec9183762" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.19.1" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "3.0.6" http: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" http_parser: dependency: transitive description: name: http_parser - sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.1.2" lints: - dependency: transitive + dependency: "direct dev" description: name: lints - sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "5.1.1" logging: dependency: "direct main" description: name: logging - sha256: "0520a4826042a8a5d09ddd4755623a50d37ee536d79a70452aff8c8ad7bb6c27" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.3.0" meta: dependency: transitive description: name: meta - sha256: "5202fdd37b4da5fd14a237ed0a01cad6c1efd4c99b5b5a0d3c9237f3728c9485" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.16.0" path: dependency: transitive description: name: path - sha256: "2ad4cddff7f5cc0e2d13069f2a3f7a73ca18f66abd6f5ecf215219cdb3638edb" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" source_span: dependency: transitive description: name: source_span - sha256: d5f89a9e52b36240a80282b3dc0667dd36e53459717bb17b8fb102d30496606a + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.1" string_scanner: dependency: transitive description: name: string_scanner - sha256: dd11571b8a03f7cadcf91ec26a77e02bfbd6bbba2a512924d3116646b4198fc4 + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - sha256: a88162591b02c1f3a3db3af8ce1ea2b374bd75a7bb8d5e353bcfbdc79d719830 + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" typed_data: dependency: transitive description: name: typed_data - sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" typesense: dependency: "direct main" description: path: "../.." relative: true source: path - version: "0.5.1" + version: "0.5.2" web: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.1.0" sdks: - dart: ">=3.3.2 <4.0.0" + dart: ">=3.6.1 <4.0.0" diff --git a/example/console-simple/pubspec.yaml b/example/console-simple/pubspec.yaml index 63ddcb0..6a4d779 100644 --- a/example/console-simple/pubspec.yaml +++ b/example/console-simple/pubspec.yaml @@ -4,12 +4,12 @@ version: 0.2.0 publish_to: none environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ^3.6.1 dependencies: typesense: path: ../../ - logging: ^1.0.1 + logging: ^1.3.0 dev_dependencies: - flutter_lints: ^1.0.4 + lints: ^5.1.1 diff --git a/lib/src/exceptions/exceptions.dart b/lib/src/exceptions/exceptions.dart index 04b6d3a..7f66f73 100644 --- a/lib/src/exceptions/exceptions.dart +++ b/lib/src/exceptions/exceptions.dart @@ -1,5 +1,3 @@ -library exceptions; - part 'typesense_exception.dart'; part 'import_error.dart'; diff --git a/lib/src/exceptions/request_exceptions/http_error.dart b/lib/src/exceptions/request_exceptions/http_error.dart index 4b77752..a05fb0c 100644 --- a/lib/src/exceptions/request_exceptions/http_error.dart +++ b/lib/src/exceptions/request_exceptions/http_error.dart @@ -3,7 +3,7 @@ part of '../exceptions.dart'; /// The request has failed because of some network layer issues like /// connection timeouts, etc. class HttpError extends RequestException { - HttpError(String message, int statusCode) : super(message, statusCode); + HttpError(super.message, super.statusCode); @override String toString() { diff --git a/lib/src/exceptions/request_exceptions/server_error.dart b/lib/src/exceptions/request_exceptions/server_error.dart index 34e9d5d..b7571ba 100644 --- a/lib/src/exceptions/request_exceptions/server_error.dart +++ b/lib/src/exceptions/request_exceptions/server_error.dart @@ -2,7 +2,7 @@ part of '../exceptions.dart'; /// 5xx server errors class ServerError extends RequestException { - ServerError(String message, int statusCode) : super(message, statusCode); + ServerError(super.message, super.statusCode); @override String toString() { diff --git a/lib/src/models/field.dart b/lib/src/models/field.dart index da89ae2..e8c1767 100644 --- a/lib/src/models/field.dart +++ b/lib/src/models/field.dart @@ -284,9 +284,6 @@ extension _Type on Type { case Type.stringify: return 'string*'; - - default: - return ''; } } diff --git a/lib/src/models/models.dart b/lib/src/models/models.dart index c59c563..e747c76 100644 --- a/lib/src/models/models.dart +++ b/lib/src/models/models.dart @@ -1,5 +1,3 @@ -library models; - import 'package:http/http.dart' as http; import '../exceptions/exceptions.dart'; diff --git a/lib/src/models/schema.dart b/lib/src/models/schema.dart index 04723b4..e3cf49e 100644 --- a/lib/src/models/schema.dart +++ b/lib/src/models/schema.dart @@ -87,7 +87,7 @@ class Schema extends BaseSchema { } class UpdateSchema extends BaseSchema { - UpdateSchema(Set fields) : super(fields); + UpdateSchema(Set super.fields); factory UpdateSchema.fromMap(Map map) { final Set fields = (map['fields'] != null) diff --git a/lib/src/services/api_call.dart b/lib/src/services/api_call.dart index 84e1927..91590dc 100644 --- a/lib/src/services/api_call.dart +++ b/lib/src/services/api_call.dart @@ -5,7 +5,6 @@ import 'dart:collection'; import 'package:http/http.dart' as http; import 'base_api_call.dart'; -import 'node_pool.dart'; import 'request_cache.dart'; import '../configuration.dart'; import '../models/models.dart'; @@ -17,9 +16,8 @@ export 'base_api_call.dart' show contentType; class ApiCall extends BaseApiCall> { final RequestCache _requestCache; - ApiCall(Configuration config, NodePool nodePool, RequestCache requestCache) - : _requestCache = requestCache, - super(config, nodePool); + ApiCall(super.config, super.nodePool, RequestCache requestCache) + : _requestCache = requestCache; /// Sends an HTTP GET request to the URL constructed using the [Node.uri], /// [endpoint] and [queryParams]. diff --git a/lib/src/services/collections_api_call.dart b/lib/src/services/collections_api_call.dart index d2be172..2e1c9c1 100644 --- a/lib/src/services/collections_api_call.dart +++ b/lib/src/services/collections_api_call.dart @@ -2,16 +2,13 @@ import 'dart:async'; import 'dart:convert'; import './base_api_call.dart'; -import './node_pool.dart'; -import '../configuration.dart'; export './base_api_call.dart' show contentType; /// Handles requests that expect JSON data of `List>` type /// from the server. class CollectionsApiCall extends BaseApiCall>> { - CollectionsApiCall(Configuration config, NodePool nodePool) - : super(config, nodePool); + CollectionsApiCall(super.config, super.nodePool); /// Sends an HTTP GET request to the URL constructed using the [Node.uri], /// [endpoint] and [queryParams]. diff --git a/lib/src/services/documents_api_call.dart b/lib/src/services/documents_api_call.dart index 1bd4eb2..e1e0e09 100644 --- a/lib/src/services/documents_api_call.dart +++ b/lib/src/services/documents_api_call.dart @@ -1,15 +1,12 @@ import 'dart:async'; import './base_api_call.dart'; -import './node_pool.dart'; -import '../configuration.dart'; export './base_api_call.dart' show contentType; /// Handles requests that expect JSONL data of `String` type from the server. class DocumentsApiCall extends BaseApiCall { - DocumentsApiCall(Configuration config, NodePool nodePool) - : super(config, nodePool); + DocumentsApiCall(super.config, super.nodePool); /// Sends an HTTP GET request to the URL constructed using the [Node.uri], /// [endpoint] and [queryParams]. diff --git a/lib/typesense.dart b/lib/typesense.dart index 7389aec..bd74efc 100644 --- a/lib/typesense.dart +++ b/lib/typesense.dart @@ -1,5 +1,3 @@ -library typesense; - export 'src/client.dart'; export 'src/search_client.dart'; export 'src/configuration.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index dff01bd..377bd4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,18 +1,18 @@ name: typesense description: Dart client library for accessing the HTTP API of Typesense search engine. -version: 0.5.1 +version: 0.5.2 repository: https://github.com/typesense/typesense-dart environment: - sdk: ^3.3.2 + sdk: ^3.6.1 dependencies: - http: ^1.2.1 - crypto: ^3.0.3 + http: ^1.3.0 + crypto: ^3.0.6 dev_dependencies: - test: ^1.25.2 - mockito: ^5.4.4 - lints: ^3.0.0 - build_runner: ^2.4.8 - analyzer: ^6.4.1 + test: ^1.25.14 + mockito: ^5.4.5 + lints: ^5.1.1 + build_runner: ^2.4.14 + analyzer: ^7.2.0 diff --git a/test/test_utils.dart b/test/test_utils.dart index 1836a11..21efe92 100644 --- a/test/test_utils.dart +++ b/test/test_utils.dart @@ -9,8 +9,6 @@ import 'package:typesense/src/models/models.dart'; import 'package:typesense/src/services/api_call.dart'; import 'package:typesense/src/services/documents_api_call.dart'; import 'package:typesense/src/services/collections_api_call.dart'; -import 'package:typesense/src/services/request_cache.dart'; -import 'package:typesense/src/services/node_pool.dart'; final String host = InternetAddress.loopbackIPv4.address; const protocol = Protocol.http, @@ -118,22 +116,19 @@ class ConfigurationFactory { customMocks: [MockSpec(as: #MockApiCall)]) class GenerateMockApiCall extends ApiCall { GenerateMockApiCall( - Configuration config, NodePool nodePool, RequestCache requestCache) - : super(config, nodePool, requestCache); + super.config, super.nodePool, super.requestCache); } @GenerateMocks([], customMocks: [ MockSpec(as: #MockCollectionsApiCall) ]) class GenerateMockCollectionsApiCall extends CollectionsApiCall { - GenerateMockCollectionsApiCall(Configuration config, NodePool nodePool) - : super(config, nodePool); + GenerateMockCollectionsApiCall(super.config, super.nodePool); } @GenerateMocks([], customMocks: [ MockSpec(as: #MockDocumentsApiCall) ]) class GenerateMockDocumentsApiCall extends DocumentsApiCall { - GenerateMockDocumentsApiCall(Configuration config, NodePool nodePool) - : super(config, nodePool); + GenerateMockDocumentsApiCall(super.config, super.nodePool); }