Skip to content

Commit 4bd7e59

Browse files
authored
feat: upgrade to dart 3 compatible dependencies (#10890)
* ci: check if compatible with dart 3 * ci: check if compatible with dart 3 * feat: upgrade deprecated setMockMethodCallHandler * feat: remove deprecated code * feat: remove deprecated code * feat: remove deprecated code * feat: remove deprecated code * feat: update ODM to support new fields * feat: update web tests * feat: update web tests * feat: go back to stable channel * feat: downgrade meta to be compatible with 2.19 and 3.0 * feat: add optionnal access to defaultBinaryMessenger * feat: fix some compatibility issues with dart 2.19 in tests * feat: fix some compatibility issues with dart 2.19 in tests
1 parent 2d616b5 commit 4bd7e59

File tree

82 files changed

+1260
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1260
-284
lines changed

Diff for: .github/workflows/e2e_tests.yaml

+49-45
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,41 @@ concurrency:
77
on:
88
pull_request:
99
paths-ignore:
10-
- "docs/**"
11-
- "website/**"
12-
- "**/example/**"
13-
- "**/flutterfire_ui/**"
14-
- "**/cloud_firestore_odm/**"
15-
- "**.md"
10+
- 'docs/**'
11+
- 'website/**'
12+
- '**/example/**'
13+
- '**/flutterfire_ui/**'
14+
- '**/cloud_firestore_odm/**'
15+
- '**.md'
1616
push:
1717
branches:
1818
- master
1919
paths-ignore:
20-
- "docs/**"
21-
- "website/**"
22-
- "**/example/**"
23-
- "**/flutterfire_ui/**"
24-
- "**/cloud_firestore_odm/**"
25-
- "**.md"
20+
- 'docs/**'
21+
- 'website/**'
22+
- '**/example/**'
23+
- '**/flutterfire_ui/**'
24+
- '**/cloud_firestore_odm/**'
25+
- '**.md'
2626

2727
jobs:
2828
android:
2929
runs-on: macos-13
3030
timeout-minutes: 45
3131
strategy:
3232
matrix:
33-
working_directory: ['tests', 'packages/cloud_firestore/cloud_firestore/example']
33+
working_directory:
34+
['tests', 'packages/cloud_firestore/cloud_firestore/example']
3435
steps:
3536
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
3637
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
3738
name: Install Node.js 16
3839
with:
39-
node-version: "16"
40+
node-version: '16'
4041
- uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98
4142
with:
42-
distribution: "temurin"
43-
java-version: "11"
43+
distribution: 'temurin'
44+
java-version: '11'
4445
- uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0
4546
name: Gradle Cache
4647
with:
@@ -69,9 +70,9 @@ jobs:
6970
with:
7071
run-bootstrap: false
7172
melos-version: '3.0.1'
72-
- name: "Bootstrap package"
73+
- name: 'Bootstrap package'
7374
run: melos bootstrap --scope tests
74-
- name: "Install Tools"
75+
- name: 'Install Tools'
7576
run: |
7677
sudo npm i -g firebase-tools
7778
- name: Start Firebase Emulator
@@ -81,37 +82,38 @@ jobs:
8182
run: |
8283
echo "List installed packages"
8384
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed
84-
85+
8586
echo "Installing system image"
8687
echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;google_apis;x86_64"
87-
88+
8889
echo "Creating AVD"
8990
echo "no" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n test_emulator -k "system-images;android-33;google_apis;x86_64" --force
9091
9192
echo "Starting emulator"
9293
$ANDROID_SDK_ROOT/emulator/emulator -avd test_emulator -no-audio -no-boot-anim -no-window &
9394
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
94-
- name: "E2E Tests"
95+
- name: 'E2E Tests'
9596
working-directory: ${{ matrix.working_directory }}
9697
run: |
97-
flutter test integration_test/e2e_test.dart --dart-define=CI=true
98+
flutter test integration_test/e2e_test.dart --dart-define=CI=true
9899
99100
ios:
100101
runs-on: macos-13
101102
timeout-minutes: 45
102103
strategy:
103104
matrix:
104-
working_directory: ['tests', 'packages/cloud_firestore/cloud_firestore/example']
105+
working_directory:
106+
['tests', 'packages/cloud_firestore/cloud_firestore/example']
105107
steps:
106108
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
107109
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
108110
name: Install Node.js 16
109111
with:
110-
node-version: "16"
112+
node-version: '16'
111113
- uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98
112114
with:
113-
distribution: "temurin"
114-
java-version: "11"
115+
distribution: 'temurin'
116+
java-version: '11'
115117
- uses: hendrikmuhs/ccache-action@fba817f3c0db4f854d7a3ee688241d6754da166e
116118
name: Xcode Compile Cache
117119
with:
@@ -138,12 +140,12 @@ jobs:
138140
with:
139141
run-bootstrap: false
140142
melos-version: '3.0.1'
141-
- name: "Bootstrap package"
143+
- name: 'Bootstrap package'
142144
run: melos bootstrap --scope tests
143-
- name: "Install Tools"
145+
- name: 'Install Tools'
144146
run: |
145147
sudo npm i -g firebase-tools
146-
- name: "Build Application"
148+
- name: 'Build Application'
147149
working-directory: ${{ matrix.working_directory }}
148150
run: |
149151
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
@@ -156,7 +158,7 @@ jobs:
156158
ccache -s
157159
- name: Start Firebase Emulator
158160
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
159-
- name: "E2E Tests"
161+
- name: 'E2E Tests'
160162
working-directory: ${{ matrix.working_directory }}
161163
run: |
162164
# Boot simulator and wait for System app to be ready.
@@ -178,17 +180,18 @@ jobs:
178180
timeout-minutes: 45
179181
strategy:
180182
matrix:
181-
working_directory: ['tests', 'packages/cloud_firestore/cloud_firestore/example']
183+
working_directory:
184+
['tests', 'packages/cloud_firestore/cloud_firestore/example']
182185
steps:
183186
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
184187
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
185188
name: Install Node.js 16
186189
with:
187-
node-version: "16"
190+
node-version: '16'
188191
- uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98
189192
with:
190-
distribution: "temurin"
191-
java-version: "11"
193+
distribution: 'temurin'
194+
java-version: '11'
192195
- uses: hendrikmuhs/ccache-action@fba817f3c0db4f854d7a3ee688241d6754da166e
193196
name: Xcode Compile Cache
194197
with:
@@ -215,12 +218,12 @@ jobs:
215218
with:
216219
run-bootstrap: false
217220
melos-version: '3.0.1'
218-
- name: "Bootstrap package"
221+
- name: 'Bootstrap package'
219222
run: melos bootstrap --scope tests
220-
- name: "Install Tools"
223+
- name: 'Install Tools'
221224
run: |
222225
sudo npm i -g firebase-tools
223-
- name: "Build Application"
226+
- name: 'Build Application'
224227
working-directory: ${{ matrix.working_directory }}
225228
run: |
226229
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
@@ -233,7 +236,7 @@ jobs:
233236
ccache -s
234237
- name: Start Firebase Emulator
235238
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
236-
- name: "E2E Tests"
239+
- name: 'E2E Tests'
237240
working-directory: ${{ matrix.working_directory }}
238241
run: |
239242
flutter test \
@@ -246,17 +249,18 @@ jobs:
246249
timeout-minutes: 15
247250
strategy:
248251
matrix:
249-
working_directory: ['tests', 'packages/cloud_firestore/cloud_firestore/example']
252+
working_directory:
253+
['tests', 'packages/cloud_firestore/cloud_firestore/example']
250254
steps:
251255
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
252256
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
253257
name: Install Node.js 16
254258
with:
255-
node-version: "16"
259+
node-version: '16'
256260
- uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98
257261
with:
258-
distribution: "temurin"
259-
java-version: "11"
262+
distribution: 'temurin'
263+
java-version: '11'
260264
- uses: subosito/flutter-action@dbf1fa04f4d2e52c33185153d06cdb5443aa189d
261265
with:
262266
channel: 'stable'
@@ -265,9 +269,9 @@ jobs:
265269
with:
266270
run-bootstrap: false
267271
melos-version: '3.0.1'
268-
- name: "Bootstrap package"
272+
- name: 'Bootstrap package'
269273
run: melos bootstrap --scope tests
270-
- name: "Install Tools"
274+
- name: 'Install Tools'
271275
run: |
272276
sudo npm i -g firebase-tools
273277
- name: Cache Firebase Emulator
@@ -278,7 +282,7 @@ jobs:
278282
restore-keys: firebase-emulators-v1
279283
- name: Start Firebase Emulator
280284
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
281-
- name: "E2E Tests"
285+
- name: 'E2E Tests'
282286
working-directory: ${{ matrix.working_directory }}
283287
# Web devices are not supported for the `flutter test` command yet. As a
284288
# workaround we can use the `flutter drive` command. Tracking issue:

Diff for: .github/workflows/firebase_firestore_odm.yaml

+14-14
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ concurrency:
77
on:
88
pull_request:
99
paths:
10-
- "packages/cloud_firestore/**"
11-
- "packages/cloud_firestore_odm/**"
12-
- ".github/workflows/firebase_firestore_odm.yaml"
10+
- 'packages/cloud_firestore/**'
11+
- 'packages/cloud_firestore_odm/**'
12+
- '.github/workflows/firebase_firestore_odm.yaml'
1313
push:
1414
branches:
1515
- master
1616
paths-ignore:
17-
- "docs/**"
18-
- "**.md"
17+
- 'docs/**'
18+
- '**.md'
1919

2020
env:
21-
FLUTTERFIRE_PLUGIN_SCOPE: "*cloud_firestore*"
22-
FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE: "*cloud_firestore_odm_example*"
21+
FLUTTERFIRE_PLUGIN_SCOPE: '*cloud_firestore*'
22+
FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE: '*cloud_firestore_odm_example*'
2323

2424
jobs:
2525
test:
@@ -37,14 +37,14 @@ jobs:
3737
with:
3838
run-bootstrap: false
3939
melos-version: '3.0.1'
40-
- name: "Bootstrap Workspace"
40+
- name: 'Bootstrap Workspace'
4141
run: |
4242
melos bootstrap --scope="*firebase_core*" --scope="$FLUTTERFIRE_PLUGIN_SCOPE"
4343
melos run odm:example_build_runner:build
4444
melos run odm:generator_test_build_runner:build
45-
- name: "Flutter Test"
45+
- name: 'Flutter Test'
4646
run: melos run odm:test:flutter --no-select
47-
- name: "Dart Test"
47+
- name: 'Dart Test'
4848
run: melos run odm:test:dart --no-select
4949

5050
integration_test:
@@ -57,7 +57,7 @@ jobs:
5757
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
5858
name: Install Node.js 16
5959
with:
60-
node-version: "16"
60+
node-version: '16'
6161
- uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98
6262
with:
6363
distribution: 'temurin'
@@ -70,17 +70,17 @@ jobs:
7070
with:
7171
run-bootstrap: false
7272
melos-version: '3.0.1'
73-
- name: "Install Tools"
73+
- name: 'Install Tools'
7474
run: |
7575
sudo npm i -g firebase-tools
76-
- name: "Bootstrap Workspace"
76+
- name: 'Bootstrap Workspace'
7777
run: |
7878
melos bootstrap --scope="*firebase_core*" --scope="$FLUTTERFIRE_PLUGIN_SCOPE"
7979
melos run odm:example_build_runner:build
8080
melos run odm:generator_test_build_runner:build
8181
- name: Start Firebase Emulator
8282
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
83-
- name: "E2E Tests"
83+
- name: 'E2E Tests'
8484
working-directory: packages/cloud_firestore_odm/cloud_firestore_odm/example
8585
# Web devices are not supported for the `flutter test` command yet. As a
8686
# workaround we can use the `flutter drive` command. Tracking issue:

Diff for: packages/_flutterfire_internals/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
firebase_core_platform_interface: ^4.6.0
1515
flutter:
1616
sdk: flutter
17-
meta: ^1.3.0
17+
meta: ^1.8.0
1818

1919
dev_dependencies:
2020
flutter_test:

Diff for: packages/cloud_firestore/cloud_firestore/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ false_secrets:
1111
- dartpad/**
1212

1313
environment:
14-
sdk: ">=2.18.0 <3.0.0"
15-
flutter: ">=1.12.13+hotfix.5"
14+
sdk: '>=2.18.0 <3.0.0'
15+
flutter: '>=1.12.13+hotfix.5'
1616

1717
dependencies:
1818
cloud_firestore_platform_interface: ^5.12.1
@@ -22,7 +22,7 @@ dependencies:
2222
firebase_core_platform_interface: ^4.6.0
2323
flutter:
2424
sdk: flutter
25-
meta: ^1.3.0
25+
meta: ^1.8.0
2626

2727
dev_dependencies:
2828
flutter_test:

Diff for: packages/cloud_firestore/cloud_firestore/test/aggregate_query_test.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import 'package:cloud_firestore_platform_interface/src/method_channel/method_cha
77
import 'package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart';
88
import 'package:cloud_firestore_platform_interface/src/method_channel/utils/firestore_message_codec.dart';
99
import 'package:firebase_core/firebase_core.dart';
10-
import 'package:flutter_test/flutter_test.dart';
1110
import 'package:flutter/services.dart';
11+
import 'package:flutter_test/flutter_test.dart';
1212

1313
import './mock.dart';
1414

@@ -21,7 +21,9 @@ void main() {
2121
StandardMethodCodec(AggregateQueryMessageCodec()),
2222
);
2323

24-
MethodChannelFirebaseFirestore.channel.setMockMethodCallHandler((call) async {
24+
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
25+
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
26+
(call) async {
2527
if (call.method == 'AggregateQuery#count') {
2628
return {
2729
'count': kCount,

Diff for: packages/cloud_firestore/cloud_firestore/test/document_reference_test.dart

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:cloud_firestore/cloud_firestore.dart';
6-
import 'package:firebase_core/firebase_core.dart';
76
import 'package:cloud_firestore_platform_interface/src/method_channel/method_channel_firestore.dart';
7+
import 'package:firebase_core/firebase_core.dart';
88
import 'package:flutter/services.dart';
99
import 'package:flutter_test/flutter_test.dart';
1010

@@ -16,9 +16,14 @@ void main() {
1616
MethodChannelFirebaseFirestore.channel = const MethodChannel(
1717
'plugins.flutter.io/firebase_firestore',
1818
StandardMethodCodec(TestFirestoreMessageCodec()),
19-
)..setMockMethodCallHandler((call) async {
20-
return null;
21-
});
19+
);
20+
21+
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
22+
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
23+
(call) async {
24+
return null;
25+
});
26+
2227
late FirebaseFirestore firestore;
2328
late FirebaseFirestore firestoreSecondary;
2429

0 commit comments

Comments
 (0)