diff --git a/analysis_options.yaml b/analysis_options.yaml index 1849fb0..5c44d3f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:flutter_lints/flutter.yaml +include: package:lints/recommended.yaml dart_code_metrics: anti-patterns: diff --git a/lib/src/source_of_truth.dart b/lib/src/source_of_truth.dart index c56a8f9..06eb0fd 100644 --- a/lib/src/source_of_truth.dart +++ b/lib/src/source_of_truth.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:flutter/widgets.dart'; +import 'package:meta/meta.dart'; import 'package:stock/src/fetcher.dart'; import 'package:stock/src/common/key_value.dart'; import 'package:stock/src/implementations/source_of_truth_impl.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index c320eb5..4e9ca32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,23 +1,22 @@ name: stock -description: A Dart package for Async Data Loading and Caching +description: Dart Library for Async Data Loading and Caching. + Combine local (DB, cache) and network data simply and safely. version: 0.0.1 homepage: https://github.com/xmartlabs/stock +repository: https://github.com/xmartlabs/stock +issue_tracker: https://github.com/xmartlabs/stock/issues environment: sdk: '>=2.12.0 <3.0.0' dependencies: - flutter: - sdk: flutter + meta: ^1.3.0 mutex: ^3.0.0 rxdart: ^0.27.0 dev_dependencies: - flutter_test: - sdk: flutter build_runner: 2.2.0 dart_code_metrics: 4.17.1 - flutter_lints: 2.0.1 + lints: 2.0.0 mockito: 5.3.0 - -flutter: + test: 1.21.4 diff --git a/scripts/checks.sh b/scripts/checks.sh index 4a7082e..374fec9 100755 --- a/scripts/checks.sh +++ b/scripts/checks.sh @@ -2,21 +2,21 @@ RED='\033[0;31m' echo ':: Get dependencies ::' -flutter pub get +dart pub get echo ':: Check code format ::' -flutter format --set-exit-if-changed . || { echo -e "${RED}Invalid format" ; exit 1; } +dart format --set-exit-if-changed . || { echo -e "${RED}Invalid format" ; exit 1; } echo ':: Run linter ::' -flutter analyze . || { echo -e "${RED}Linter error" ; exit 1; } +dart analyze . || { echo -e "${RED}Linter error" ; exit 1; } -result=$(flutter pub run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings) +result=$(dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings) echo "$result" [[ $result == '✔ no issues found!' ]] || { echo -e "${RED}Linter error" ; exit 1; } -flutter pub run dart_code_metrics:metrics check-unused-code lib --fatal-unused || { echo -e "${RED}Linter error" ; exit 1; } +dart run dart_code_metrics:metrics check-unused-code lib --fatal-unused || { echo -e "${RED}Linter error" ; exit 1; } -flutter pub run dart_code_metrics:metrics check-unused-files lib --fatal-unused || { echo -e "${RED}Linter error" ; exit 1; } +dart run dart_code_metrics:metrics check-unused-files lib --fatal-unused || { echo -e "${RED}Linter error" ; exit 1; } echo ':: Run tests ::' -flutter test || { echo -e "${RED}Test error" ; exit 1; } +dart test || { echo -e "${RED}Test error" ; exit 1; } diff --git a/test/common_errors_test.dart b/test/common_errors_test.dart index e2096b6..96e77a7 100644 --- a/test/common_errors_test.dart +++ b/test/common_errors_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/fetcher.dart'; import 'package:stock/src/stock.dart'; import 'package:stock/src/stock_response.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/source_of_truth_with_error.dart'; import 'common/stock_test_extensions.dart'; diff --git a/test/fresh_and_get_test.dart b/test/fresh_and_get_test.dart index 7bc2e1c..0fca1fc 100644 --- a/test/fresh_and_get_test.dart +++ b/test/fresh_and_get_test.dart @@ -1,6 +1,6 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:stock/src/stock.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/cached_and_mocked_source_of_truth.dart'; import 'common_mocks.mocks.dart'; diff --git a/test/mapper_test.dart b/test/mapper_test.dart index a08aa7e..517ab92 100644 --- a/test/mapper_test.dart +++ b/test/mapper_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/source_of_truth.dart'; import 'package:stock/src/stock_extensions.dart'; import 'package:stock/src/type_mapper.dart'; +import 'package:test/test.dart'; void main() { group("Mapper test", () { diff --git a/test/multiple_request_test.dart b/test/multiple_request_test.dart index 448cb6e..01de01d 100644 --- a/test/multiple_request_test.dart +++ b/test/multiple_request_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/fetcher.dart'; import 'package:stock/src/stock.dart'; import 'package:stock/src/stock_response.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/cached_and_mocked_source_of_truth.dart'; import 'common/stock_test_extensions.dart'; diff --git a/test/refresh_test.dart b/test/refresh_test.dart index 102016b..647ff83 100644 --- a/test/refresh_test.dart +++ b/test/refresh_test.dart @@ -1,8 +1,8 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:stock/src/source_of_truth.dart'; import 'package:stock/src/stock.dart'; import 'package:stock/src/stock_response.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/cached_source_of_truth_with_default_value.dart'; import 'common/source_of_truth/source_of_truth_with_error.dart'; diff --git a/test/source_of_truth_test.dart b/test/source_of_truth_test.dart index db70664..490a5b2 100644 --- a/test/source_of_truth_test.dart +++ b/test/source_of_truth_test.dart @@ -1,5 +1,5 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/source_of_truth.dart'; +import 'package:test/test.dart'; import 'common/stock_test_extensions.dart'; diff --git a/test/stock_response_extension_test.dart b/test/stock_response_extension_test.dart index d71882b..aa9e60f 100644 --- a/test/stock_response_extension_test.dart +++ b/test/stock_response_extension_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/errors.dart'; import 'package:stock/src/stock_response.dart'; import 'package:stock/src/stock_response_extensions.dart'; +import 'package:test/test.dart'; void main() { group('Require data extensions', () { diff --git a/test/stock_without_key_test.dart b/test/stock_without_key_test.dart index 5d5166c..64d6336 100644 --- a/test/stock_without_key_test.dart +++ b/test/stock_without_key_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:stock/src/stock.dart'; import 'package:stock/src/stock_response.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/cached_source_of_truth_with_default_value.dart'; import 'common/stock_test_extensions.dart'; diff --git a/test/store_valid_result_store_test.dart b/test/store_valid_result_store_test.dart index b1c02d3..28f1749 100644 --- a/test/store_valid_result_store_test.dart +++ b/test/store_valid_result_store_test.dart @@ -1,7 +1,7 @@ -import 'package:flutter_test/flutter_test.dart'; import 'package:stock/src/fetcher.dart'; import 'package:stock/src/stock.dart'; import 'package:stock/src/stock_response.dart'; +import 'package:test/test.dart'; import 'common/source_of_truth/cached_source_of_truth_with_default_value.dart'; import 'common/source_of_truth/source_of_truth_with_delay.dart';