From c1296c9ba0cc43284b31d78f2f484454fbf6b773 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Tue, 30 May 2023 16:30:11 +0200 Subject: [PATCH] chore!: Bump Flutter to version 3.10.x (#1529) # Description - chore: bump flame_lint to v1.0.0 - chore: bump min flutter to v3.10.0 - chore: bump min dart sdk to v3.0.0 - chore: bump http to v1.0.0 (closes #1528) - add melos commands for: `dart pub outdated` & `dart pub upgrade --major-versions` ## Breaking Change - [x] Yes, this is a breaking change. ### Migration instructions Before: ```yaml # pubspec.yaml environment: sdk: ">=2.x.x <3.0.0" flutter: ">=3.x.x" ``` After: ```yaml # pubspec.yaml environment: sdk: ">=3.0.0 <4.0.0" flutter: ">=3.10.0" ``` --- .github/workflows/build-example.yml | 2 +- .github/workflows/release.yml | 4 +- .github/workflows/test.yml | 3 +- melos.yaml | 9 +++++ .../example/lib/components/cbx.dart | 4 +- .../example/lib/components/indexed_stack.dart | 39 ------------------- packages/audioplayers/example/lib/main.dart | 3 +- .../example/lib/tabs/audio_context.dart | 24 +++++++----- packages/audioplayers/example/pubspec.yaml | 8 ++-- .../audioplayers/example/server/pubspec.yaml | 6 +-- packages/audioplayers/pubspec.yaml | 8 ++-- packages/audioplayers_android/pubspec.yaml | 6 +-- packages/audioplayers_darwin/pubspec.yaml | 6 +-- packages/audioplayers_linux/pubspec.yaml | 6 +-- .../pubspec.yaml | 6 +-- .../test/audioplayers_platform_test.dart | 2 +- .../test/global_platform_test.dart | 2 +- .../test/util.dart | 4 +- packages/audioplayers_web/pubspec.yaml | 6 +-- packages/audioplayers_windows/pubspec.yaml | 6 +-- 20 files changed, 62 insertions(+), 92 deletions(-) delete mode 100644 packages/audioplayers/example/lib/components/indexed_stack.dart diff --git a/.github/workflows/build-example.yml b/.github/workflows/build-example.yml index 07c39b176..17bb7fe75 100644 --- a/.github/workflows/build-example.yml +++ b/.github/workflows/build-example.yml @@ -47,7 +47,7 @@ on: inputs: flutter_version: required: false - default: '3.7.12' + default: '3.10.2' type: string enable_android: required: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8f736c06..b15a7d389 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,5 @@ jobs: call-min-flutter-test: uses: ./.github/workflows/test.yml with: - flutter_version: '3.3.x' + flutter_version: '3.10.x' fatal_warnings: false - # TODO(gustl22): Windows tests fail on Flutter <= 3.3.x, remove when setting min version to 3.7.x - enable_windows: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90d8d87fd..fb6a49e46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,6 @@ on: - '3.10.x' - '3.7.x' - '3.3.x' - - '3.0.x' fatal_warnings: description: 'Treat warnings as fatal' required: false @@ -52,7 +51,7 @@ on: inputs: flutter_version: required: false - default: '3.7.12' + default: '3.10.2' type: string fatal_warnings: required: false diff --git a/melos.yaml b/melos.yaml index 7f231af3e..d77f2d85d 100644 --- a/melos.yaml +++ b/melos.yaml @@ -38,6 +38,15 @@ scripts: packageFilters: ignore: "*_example" + pub-outdated: + run: melos exec dart pub outdated + description: Run `dart pub outdated` for all packages. + + pub-upgrade: + # May fails until https://github.com/dart-lang/pub/pull/3920 is released + run: melos exec dart pub upgrade --major-versions + description: Run `dart pub upgrade --major-versions` for all packages. + test:select: run: melos exec flutter test packageFilters: diff --git a/packages/audioplayers/example/lib/components/cbx.dart b/packages/audioplayers/example/lib/components/cbx.dart index c09feef1c..65674a2a1 100644 --- a/packages/audioplayers/example/lib/components/cbx.dart +++ b/packages/audioplayers/example/lib/components/cbx.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class Cbx extends StatelessWidget { final String label; final bool value; - final void Function(bool) update; + final void Function({required bool? value}) update; const Cbx( this.label, @@ -17,7 +17,7 @@ class Cbx extends StatelessWidget { return CheckboxListTile( title: Text(label), value: value, - onChanged: (v) => update(v!), + onChanged: (v) => update(value: v), ); } } diff --git a/packages/audioplayers/example/lib/components/indexed_stack.dart b/packages/audioplayers/example/lib/components/indexed_stack.dart deleted file mode 100644 index 14515537d..000000000 --- a/packages/audioplayers/example/lib/components/indexed_stack.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; - -// Unfortunately IndexedStack does keep all children onstage for debugging: -// https://github.com/flutter/flutter/issues/111478 -class IndexedStack2 extends IndexedStack { - IndexedStack2({ - super.key, - super.alignment, - super.textDirection, - super.sizing, - super.index, - super.children, - }); - - @override - MultiChildRenderObjectElement createElement() { - return _IndexedStackElement(this); - } -} - -class _IndexedStackElement extends MultiChildRenderObjectElement { - _IndexedStackElement(IndexedStack super.widget); - - @override - IndexedStack get widget => super.widget as IndexedStack; - - @override - void debugVisitOnstageChildren(ElementVisitor visitor) { - final index = widget.index; - if (index == null) { - return super.debugVisitOnstageChildren(visitor); - } else { - final onlyOnstageChild = children.skip(index).iterator; - if (onlyOnstageChild.moveNext()) { - visitor(onlyOnstageChild.current); - } - } - } -} diff --git a/packages/audioplayers/example/lib/main.dart b/packages/audioplayers/example/lib/main.dart index 6a8b3958c..6247b046c 100644 --- a/packages/audioplayers/example/lib/main.dart +++ b/packages/audioplayers/example/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:audioplayers/audioplayers.dart'; -import 'package:audioplayers_example/components/indexed_stack.dart'; import 'package:audioplayers_example/components/tabs.dart'; import 'package:audioplayers_example/components/tgl.dart'; import 'package:audioplayers_example/tabs/audio_context.dart'; @@ -148,7 +147,7 @@ class _ExampleAppState extends State<_ExampleApp> { Expanded( child: audioPlayers.isEmpty ? const Text('No AudioPlayer available!') - : IndexedStack2( + : IndexedStack( index: selectedPlayerIdx, children: audioPlayers .map( diff --git a/packages/audioplayers/example/lib/tabs/audio_context.dart b/packages/audioplayers/example/lib/tabs/audio_context.dart index fa841f512..e3c573ac8 100644 --- a/packages/audioplayers/example/lib/tabs/audio_context.dart +++ b/packages/audioplayers/example/lib/tabs/audio_context.dart @@ -106,22 +106,26 @@ class AudioContextTabState extends State Cbx( 'Force Speaker', value: audioContextConfig.forceSpeaker, - (v) => updateConfig(audioContextConfig.copy(forceSpeaker: v)), + ({value}) => + updateConfig(audioContextConfig.copy(forceSpeaker: value)), ), Cbx( 'Duck Audio', value: audioContextConfig.duckAudio, - (v) => updateConfig(audioContextConfig.copy(duckAudio: v)), + ({value}) => updateConfig( + audioContextConfig.copy(duckAudio: value), + ), ), Cbx( 'Respect Silence', value: audioContextConfig.respectSilence, - (v) => updateConfig(audioContextConfig.copy(respectSilence: v)), + ({value}) => + updateConfig(audioContextConfig.copy(respectSilence: value)), ), Cbx( 'Stay Awake', value: audioContextConfig.stayAwake, - (v) => updateConfig(audioContextConfig.copy(stayAwake: v)), + ({value}) => updateConfig(audioContextConfig.copy(stayAwake: value)), ), ], ); @@ -133,15 +137,15 @@ class AudioContextTabState extends State Cbx( 'isSpeakerphoneOn', value: audioContext.android.isSpeakerphoneOn, - (v) => updateAudioContextAndroid( - audioContext.android.copy(isSpeakerphoneOn: v), + ({value}) => updateAudioContextAndroid( + audioContext.android.copy(isSpeakerphoneOn: value), ), ), Cbx( 'stayAwake', value: audioContext.android.stayAwake, - (v) => updateAudioContextAndroid( - audioContext.android.copy(stayAwake: v), + ({value}) => updateAudioContextAndroid( + audioContext.android.copy(stayAwake: value), ), ), LabeledDropDown( @@ -191,8 +195,8 @@ class AudioContextTabState extends State return Cbx( option.name, value: options.contains(option), - (v) { - if (v) { + ({value}) { + if (value ?? false) { options.add(option); } else { options.remove(option); diff --git a/packages/audioplayers/example/pubspec.yaml b/packages/audioplayers/example/pubspec.yaml index 2b106cadd..0d85c75c7 100644 --- a/packages/audioplayers/example/pubspec.yaml +++ b/packages/audioplayers/example/pubspec.yaml @@ -8,7 +8,7 @@ dependencies: file_picker: ^5.0.1 flutter: sdk: flutter - http: ^0.13.1 + http: ^1.0.0 path_provider: ^2.0.12 provider: ^6.0.5 @@ -16,7 +16,7 @@ dev_dependencies: # Integration tests for audioplayers_platform_interface are handled # in this package to avoid maintaining multiple example apps: audioplayers_platform_interface: ^5.0.1 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter integration_test: @@ -29,5 +29,5 @@ flutter: - assets/ environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers/example/server/pubspec.yaml b/packages/audioplayers/example/server/pubspec.yaml index 7fa4b9bda..0d3620dc1 100644 --- a/packages/audioplayers/example/server/pubspec.yaml +++ b/packages/audioplayers/example/server/pubspec.yaml @@ -2,7 +2,7 @@ name: audioplayers_test_server publish_to: none environment: - sdk: ">=2.18.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: shelf: ^1.2.0 @@ -10,5 +10,5 @@ dependencies: shelf_static: ^1.0.0 dev_dependencies: - flame_lint: ^0.2.0 - http: ^0.13.0 + flame_lint: ^1.0.0 + http: ^1.0.0 diff --git a/packages/audioplayers/pubspec.yaml b/packages/audioplayers/pubspec.yaml index 58ca36ef7..236810dff 100644 --- a/packages/audioplayers/pubspec.yaml +++ b/packages/audioplayers/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: file: ^6.1.0 flutter: sdk: flutter - http: ^0.13.5 + http: ^1.0.0 meta: ^1.7.0 path_provider: ^2.0.12 synchronized: ^3.0.0 @@ -38,11 +38,11 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_android/pubspec.yaml b/packages/audioplayers_android/pubspec.yaml index 3c6a6dfea..d7e46c3f4 100644 --- a/packages/audioplayers_android/pubspec.yaml +++ b/packages/audioplayers_android/pubspec.yaml @@ -19,11 +19,11 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_darwin/pubspec.yaml b/packages/audioplayers_darwin/pubspec.yaml index 7b03602d6..221aa1d85 100644 --- a/packages/audioplayers_darwin/pubspec.yaml +++ b/packages/audioplayers_darwin/pubspec.yaml @@ -20,11 +20,11 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_linux/pubspec.yaml b/packages/audioplayers_linux/pubspec.yaml index f8c732497..45c2b77f6 100644 --- a/packages/audioplayers_linux/pubspec.yaml +++ b/packages/audioplayers_linux/pubspec.yaml @@ -18,11 +18,11 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_platform_interface/pubspec.yaml b/packages/audioplayers_platform_interface/pubspec.yaml index b06722439..82e7a5c2f 100644 --- a/packages/audioplayers_platform_interface/pubspec.yaml +++ b/packages/audioplayers_platform_interface/pubspec.yaml @@ -12,10 +12,10 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_platform_interface/test/audioplayers_platform_test.dart b/packages/audioplayers_platform_interface/test/audioplayers_platform_test.dart index fdf88dfa3..96ad0cb9a 100644 --- a/packages/audioplayers_platform_interface/test/audioplayers_platform_test.dart +++ b/packages/audioplayers_platform_interface/test/audioplayers_platform_test.dart @@ -13,7 +13,7 @@ void main() { final platform = AudioplayersPlatformInterface.instance; final methodCalls = []; - TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler( const MethodChannel('xyz.luan/audioplayers'), (MethodCall methodCall) async { diff --git a/packages/audioplayers_platform_interface/test/global_platform_test.dart b/packages/audioplayers_platform_interface/test/global_platform_test.dart index c65b0068f..9ba80dd18 100644 --- a/packages/audioplayers_platform_interface/test/global_platform_test.dart +++ b/packages/audioplayers_platform_interface/test/global_platform_test.dart @@ -30,7 +30,7 @@ void main() { } group('Global Method Channel', () { - TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler( const MethodChannel('xyz.luan/audioplayers.global'), (MethodCall methodCall) async { diff --git a/packages/audioplayers_platform_interface/test/util.dart b/packages/audioplayers_platform_interface/test/util.dart index e2e75b780..105ca6536 100644 --- a/packages/audioplayers_platform_interface/test/util.dart +++ b/packages/audioplayers_platform_interface/test/util.dart @@ -12,12 +12,12 @@ void createNativeEventStream({ required String channel, Stream? byteDataStream, }) { - TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMessageHandler(channel, (ByteData? message) async { final methodCall = const StandardMethodCodec().decodeMethodCall(message); if (methodCall.method == 'listen') { byteDataStream?.listen((byteData) async { - await TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger + await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .handlePlatformMessage( channel, byteData, diff --git a/packages/audioplayers_web/pubspec.yaml b/packages/audioplayers_web/pubspec.yaml index cd201acc7..b5823f0e7 100644 --- a/packages/audioplayers_web/pubspec.yaml +++ b/packages/audioplayers_web/pubspec.yaml @@ -21,10 +21,10 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" diff --git a/packages/audioplayers_windows/pubspec.yaml b/packages/audioplayers_windows/pubspec.yaml index 75bd61668..d94320032 100644 --- a/packages/audioplayers_windows/pubspec.yaml +++ b/packages/audioplayers_windows/pubspec.yaml @@ -18,11 +18,11 @@ dependencies: dev_dependencies: dartdoc: ^6.1.5 - flame_lint: ^0.2.0 + flame_lint: ^1.0.0 flutter_test: sdk: flutter environment: - sdk: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0"