From 5e5aedef9fb96ed925578ef92cb02b921d3362fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Irland?= Date: Fri, 18 Nov 2022 09:46:54 -0300 Subject: [PATCH] Make SOT optional in the Stock constructor (#33) --- .github/workflows/dart-ci.yml | 8 +++++++- lib/src/stock.dart | 2 +- test/store_valid_result_store_test.dart | 5 +---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dart-ci.yml b/.github/workflows/dart-ci.yml index 4df03c2..d838e3e 100644 --- a/.github/workflows/dart-ci.yml +++ b/.github/workflows/dart-ci.yml @@ -12,15 +12,21 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' - name: Install dependencies run: dart pub get - name: Verify formatting run: dart format --output=none --set-exit-if-changed . - - name: Analyze project source + - name: Dart Analyze project source run: dart analyze --fatal-infos + - name: Flutter Analyze project source + run: flutter analyze . + - name: Analyze project source - Code Metrics run: | result=$(dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings) diff --git a/lib/src/stock.dart b/lib/src/stock.dart index a4580e2..41de66f 100644 --- a/lib/src/stock.dart +++ b/lib/src/stock.dart @@ -18,7 +18,7 @@ abstract class Stock { /// Stock constructor factory Stock({ required Fetcher fetcher, - required SourceOfTruth? sourceOfTruth, + SourceOfTruth? sourceOfTruth, }) => StockImpl(fetcher: fetcher, sourceOfTruth: sourceOfTruth); diff --git a/test/store_valid_result_store_test.dart b/test/store_valid_result_store_test.dart index 38ec5d8..6681edc 100644 --- a/test/store_valid_result_store_test.dart +++ b/test/store_valid_result_store_test.dart @@ -75,10 +75,7 @@ void main() { test('Test a stock with only a stream fetcher', () async { final fetcher = Fetcher.ofStream((int key) => Stream.fromIterable([1, 2, 3])); - final stock = Stock( - fetcher: fetcher, - sourceOfTruth: null, - ); + final stock = Stock(fetcher: fetcher); final resultList = await stock.getFreshResult(1); expect(