From 4b63240633ea624e6f293e629812f314ed977c55 Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Mon, 15 May 2023 11:44:01 +1000 Subject: [PATCH] Set minimum Flutter 3 for just_audio --- just_audio/CHANGELOG.md | 4 ++++ just_audio/analysis_options.yaml | 7 ++++--- just_audio/example/pubspec.yaml | 2 +- just_audio/lib/just_audio.dart | 16 ++++++++-------- just_audio/pubspec.yaml | 17 +++++++++++------ just_audio/test/just_audio_test.dart | 21 ++++++++++++++------- 6 files changed, 42 insertions(+), 25 deletions(-) diff --git a/just_audio/CHANGELOG.md b/just_audio/CHANGELOG.md index 04efa8bba..f1a69f1ca 100644 --- a/just_audio/CHANGELOG.md +++ b/just_audio/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.33 + +* Update minimum flutter version to 3.0. + ## 0.9.32 * Fix ignored tag parameter in AudioSource.asset(). diff --git a/just_audio/analysis_options.yaml b/just_audio/analysis_options.yaml index de7a7ab16..46c844882 100644 --- a/just_audio/analysis_options.yaml +++ b/just_audio/analysis_options.yaml @@ -1,9 +1,10 @@ include: package:flutter_lints/flutter.yaml analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false + language: + strict-casts: true + strict-inference: true + strict-raw-types: true linter: rules: diff --git a/just_audio/example/pubspec.yaml b/just_audio/example/pubspec.yaml index f5f609a18..a3529edb3 100644 --- a/just_audio/example/pubspec.yaml +++ b/just_audio/example/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: flutter: sdk: flutter - audio_session: ^0.1.11 + audio_session: ^0.1.14 rxdart: ^0.27.7 just_audio_mpv: ^0.1.6 just_audio_windows: ^0.2.0 diff --git a/just_audio/lib/just_audio.dart b/just_audio/lib/just_audio.dart index 8454c89a2..10c07f5ee 100644 --- a/just_audio/lib/just_audio.dart +++ b/just_audio/lib/just_audio.dart @@ -86,13 +86,13 @@ class AudioPlayer { /// implementation. When switching between active and inactive modes, this is /// used to cancel the subscription to the previous platform's events and /// subscribe to the new platform's events. - StreamSubscription? _playbackEventSubscription; + StreamSubscription? _playbackEventSubscription; /// The subscription to the data event channel of the current platform /// implementation. When switching between active and inactive modes, this is /// used to cancel the subscription to the previous platform's events and /// subscribe to the new platform's events. - StreamSubscription? _playerDataSubscription; + StreamSubscription? _playerDataSubscription; final String _id; final _proxy = _ProxyHttpServer(); @@ -614,8 +614,8 @@ class AudioPlayer { } Timer? currentTimer; - StreamSubscription? durationSubscription; - StreamSubscription? playbackEventSubscription; + StreamSubscription? durationSubscription; + StreamSubscription? playbackEventSubscription; void yieldPosition(Timer timer) { if (controller.isClosed) { timer.cancel(); @@ -1992,13 +1992,13 @@ class _ProxyHttpServer { String _requestKey(Uri uri) => '${uri.path}?${uri.query}'; /// Start the server if it is not already running. - Future ensureRunning() async { + Future ensureRunning() async { if (_running) return; return await start(); } /// Starts the server. - Future start() async { + Future start() async { _running = true; _server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0); _server.listen((request) async { @@ -2015,7 +2015,7 @@ class _ProxyHttpServer { } /// Stops the server - Future stop() async { + Future stop() async { if (!_running) return; _running = false; return await _server.close(); @@ -2841,7 +2841,7 @@ class LockCachingAudioSource extends StreamAudioSource { final mimeFile = await _mimeFile; await mimeFile.writeAsString(mimeType); final inProgressResponses = <_InProgressCacheResponse>[]; - late StreamSubscription subscription; + late StreamSubscription> subscription; var percentProgress = 0; void updateProgress(int newPercentProgress) { if (newPercentProgress != percentProgress) { diff --git a/just_audio/pubspec.yaml b/just_audio/pubspec.yaml index 53552f083..2c4d4fc55 100644 --- a/just_audio/pubspec.yaml +++ b/just_audio/pubspec.yaml @@ -1,21 +1,26 @@ name: just_audio description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback. -version: 0.9.32 +version: 0.9.33 repository: https://github.com/ryanheise/just_audio/tree/minor/just_audio issue_tracker: https://github.com/ryanheise/just_audio/issues +topics: + - audio + - sound + - player + - background environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" + sdk: ">=2.14.0 <4.0.0" + flutter: ">=3.0.0" dependencies: - just_audio_platform_interface: ^4.2.0 + just_audio_platform_interface: ^4.2.1 # just_audio_platform_interface: # path: ../just_audio_platform_interface - just_audio_web: ^0.4.7 + just_audio_web: ^0.4.8 # just_audio_web: # path: ../just_audio_web - audio_session: ^0.1.11 + audio_session: ^0.1.14 rxdart: '>=0.26.0 <0.28.0' path: ^1.8.0 path_provider: ^2.0.0 diff --git a/just_audio/test/just_audio_test.dart b/just_audio/test/just_audio_test.dart index ec813f454..f84ced22e 100644 --- a/just_audio/test/just_audio_test.dart +++ b/just_audio/test/just_audio_test.dart @@ -52,13 +52,18 @@ void runTests() { } setUp(() { - audioSessionChannel.setMockMethodCallHandler((MethodCall methodCall) async { + _ambiguate(TestDefaultBinaryMessengerBinding.instance)! + .defaultBinaryMessenger + .setMockMethodCallHandler(audioSessionChannel, + (MethodCall methodCall) async { return null; }); }); tearDown(() { - audioSessionChannel.setMockMethodCallHandler(null); + _ambiguate(TestDefaultBinaryMessengerBinding.instance)! + .defaultBinaryMessenger + .setMockMethodCallHandler(audioSessionChannel, null); }); test('init', () async { @@ -346,7 +351,7 @@ void runTests() { stopwatch.start(); var completer = Completer(); - late StreamSubscription subscription; + late StreamSubscription subscription; subscription = player.positionStream.listen((position) { if (position >= position1) { subscription.cancel(); @@ -1091,7 +1096,7 @@ void runTests() { playing: false, ); var completer = Completer(); - late StreamSubscription subscription; + late StreamSubscription subscription; subscription = player.positionStream.listen((position) { expectDuration(position, Duration.zero); subscription.cancel(); @@ -1170,7 +1175,7 @@ void runTests() { ); expect(player.currentIndex, 0); var completer = Completer(); - late StreamSubscription subscription; + late StreamSubscription subscription; subscription = player.positionStream.listen((position) { expectDuration(position, Duration.zero); subscription.cancel(); @@ -1743,7 +1748,7 @@ class MockWebServer { late HttpServer _server; int get port => _server.port; - Future start() async { + Future start() async { _server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0); _server.listen((request) async { final response = request.response; @@ -1766,7 +1771,9 @@ class MockWebServer { }); } - Future stop() => _server.close(); + Future stop() => _server.close(); } class MyHttpOverrides extends HttpOverrides {} + +T? _ambiguate(T? value) => value;