Skip to content

Commit

Permalink
Remove flutter dependency (use just dart) (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirland authored Aug 29, 2022
1 parent 4b3df2f commit 0204ea4
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:flutter_lints/flutter.yaml
include: package:lints/recommended.yaml

dart_code_metrics:
anti-patterns:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/source_of_truth.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
15 changes: 7 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions scripts/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
2 changes: 1 addition & 1 deletion test/common_errors_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/fresh_and_get_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/mapper_test.dart
Original file line number Diff line number Diff line change
@@ -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", () {
Expand Down
2 changes: 1 addition & 1 deletion test/multiple_request_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/refresh_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/source_of_truth_test.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion test/stock_response_extension_test.dart
Original file line number Diff line number Diff line change
@@ -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', () {
Expand Down
2 changes: 1 addition & 1 deletion test/stock_without_key_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion test/store_valid_result_store_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 0204ea4

Please sign in to comment.