diff --git a/lib/src/matomo.dart b/lib/src/matomo.dart index 0f31cb2..718e65a 100644 --- a/lib/src/matomo.dart +++ b/lib/src/matomo.dart @@ -386,7 +386,7 @@ class MatomoTracker { } /// Iterate on the actions in the queue and send them to Matomo. - FutureOr dispatchActions() { + Future dispatchActions() { return _dequeue(); } @@ -716,7 +716,7 @@ class MatomoTracker { } } - FutureOr _dequeue() { + Future _dequeue() async { if (!_initialized) { throw const UninitializedMatomoInstanceException(); } diff --git a/lib/utils/lock.dart b/lib/utils/lock.dart index 70b63ff..ba9814d 100644 --- a/lib/utils/lock.dart +++ b/lib/utils/lock.dart @@ -10,7 +10,7 @@ class Lock { bool get locked => last != null; Future synchronized( - FutureOr Function() func, + Future Function() func, ) async { final prev = last; final completer = Completer.sync(); diff --git a/test/ressources/utils/uninitialized_test_util.dart b/test/ressources/utils/uninitialized_test_util.dart index 9e408d0..4bd9429 100644 --- a/test/ressources/utils/uninitialized_test_util.dart +++ b/test/ressources/utils/uninitialized_test_util.dart @@ -1,11 +1,9 @@ -import 'dart:async'; - import 'package:flutter_test/flutter_test.dart'; import 'package:matomo_tracker/src/exceptions.dart'; import 'package:matomo_tracker/src/matomo.dart'; import 'package:meta/meta.dart'; -typedef TrackerCallback = FutureOr Function(MatomoTracker tracker); +typedef TrackerCallback = Future Function(MatomoTracker tracker); /// A test that expects the [callback] to throw an /// [UninitializedMatomoInstanceException]. @@ -17,7 +15,7 @@ void uninitializedTest(TrackerCallback callback) { final matomoTracker = MatomoTracker(); await expectLater( - () async => await callback(matomoTracker), + () async => callback(matomoTracker), throwsA(isA()), ); }, diff --git a/test/src/matomo_test.dart b/test/src/matomo_test.dart index 5e101a5..70f14ac 100644 --- a/test/src/matomo_test.dart +++ b/test/src/matomo_test.dart @@ -170,7 +170,7 @@ void main() { group('trackScreenWithName', () { uninitializedTest( - (tracker) { + (tracker) async { tracker.trackScreenWithName( actionName: matomoTrackerMockWidget.toStringShort(), ); @@ -268,7 +268,7 @@ void main() { }); group('setVisitorUserId', () { - uninitializedTest((tracker) => tracker.setVisitorUserId(uid)); + uninitializedTest((tracker) async => tracker.setVisitorUserId(uid)); test('it should be able to set visitor userId', () async { final matomoTracker = await getInitializedMatomoTracker();