Skip to content

Commit e0087c8

Browse files
authored
refactor: upgrade project to remove warnings from Flutter 3.7 (#10344)
* refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7 * refactor: remove deprecated lints in Flutter 3.7
1 parent b703055 commit e0087c8

File tree

57 files changed

+197
-305
lines changed

Some content is hidden

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

57 files changed

+197
-305
lines changed

Diff for: .github/workflows/e2e_tests.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ jobs:
223223
restore-keys: firebase-emulators-v1
224224
- uses: subosito/flutter-action@v2
225225
with:
226-
channel: 'stable'
226+
# TODO(Lyokone): upgrade to stable when https://github.com/flutter/flutter/issues/118469 is closed
227+
flutter-version: '3.3.10'
227228
cache: true
228229
- uses: bluefireteam/melos-action@v2
229230
with:

Diff for: .github/workflows/firebase_firestore.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ jobs:
7171
java-version: '11'
7272
- uses: subosito/flutter-action@v2
7373
with:
74-
channel: 'stable'
74+
# TODO(Lyokone): upgrade to stable when https://github.com/flutter/flutter/issues/118469 is closed
75+
flutter-version: '3.3.10'
7576
cache: true
7677
- uses: bluefireteam/melos-action@v1
7778
with:

Diff for: analysis_options.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ linter:
7474
# and `@required Widget child` last.
7575
always_put_required_named_parameters_first: false
7676

77-
# `as` is not that bad (especially with the upcoming non-nullable types).
78-
# Explicit exceptions is better than implicit exceptions.
79-
avoid_as: false
80-
8177
# This project doesn't use Flutter-style todos
8278
flutter_style_todos: false
8379

Diff for: packages/cloud_firestore/cloud_firestore/dartpad/lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// for details. All rights reserved. Use of this source code is governed by a
44
// BSD-style license that can be found in the LICENSE file.
55

6-
import 'package:firebase_core/firebase_core.dart';
76
import 'package:cloud_firestore/cloud_firestore.dart';
7+
import 'package:firebase_core/firebase_core.dart';
88
import 'package:flutter/material.dart';
99

1010
Future<void> main() async {
@@ -100,7 +100,7 @@ class _FilmListState extends State<FilmList> {
100100
builder: (context, _) {
101101
return Text(
102102
'Latest Snapshot: ${DateTime.now()}',
103-
style: Theme.of(context).textTheme.caption,
103+
style: Theme.of(context).textTheme.bodySmall,
104104
);
105105
},
106106
)

Diff for: packages/cloud_firestore/cloud_firestore/example/lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class _FilmListState extends State<FilmList> {
109109
builder: (context, _) {
110110
return Text(
111111
'Latest Snapshot: ${DateTime.now()}',
112-
style: Theme.of(context).textTheme.caption,
112+
style: Theme.of(context).textTheme.bodySmall,
113113
);
114114
},
115115
)

Diff for: packages/cloud_firestore/cloud_firestore/example/macos/Runner.xcodeproj/project.pbxproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXAggregateTarget section */
@@ -260,6 +260,7 @@
260260
/* Begin PBXShellScriptBuildPhase section */
261261
3399D490228B24CF009A79C7 /* ShellScript */ = {
262262
isa = PBXShellScriptBuildPhase;
263+
alwaysOutOfDate = 1;
263264
buildActionMask = 2147483647;
264265
files = (
265266
);
@@ -425,7 +426,7 @@
425426
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
426427
GCC_WARN_UNUSED_FUNCTION = YES;
427428
GCC_WARN_UNUSED_VARIABLE = YES;
428-
MACOSX_DEPLOYMENT_TARGET = 10.11;
429+
MACOSX_DEPLOYMENT_TARGET = 10.14;
429430
MTL_ENABLE_DEBUG_INFO = NO;
430431
SDKROOT = macosx;
431432
SWIFT_COMPILATION_MODE = wholemodule;
@@ -505,7 +506,7 @@
505506
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
506507
GCC_WARN_UNUSED_FUNCTION = YES;
507508
GCC_WARN_UNUSED_VARIABLE = YES;
508-
MACOSX_DEPLOYMENT_TARGET = 10.11;
509+
MACOSX_DEPLOYMENT_TARGET = 10.14;
509510
MTL_ENABLE_DEBUG_INFO = YES;
510511
ONLY_ACTIVE_ARCH = YES;
511512
SDKROOT = macosx;
@@ -552,7 +553,7 @@
552553
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
553554
GCC_WARN_UNUSED_FUNCTION = YES;
554555
GCC_WARN_UNUSED_VARIABLE = YES;
555-
MACOSX_DEPLOYMENT_TARGET = 10.11;
556+
MACOSX_DEPLOYMENT_TARGET = 10.14;
556557
MTL_ENABLE_DEBUG_INFO = NO;
557558
SDKROOT = macosx;
558559
SWIFT_COMPILATION_MODE = wholemodule;

Diff for: packages/cloud_firestore/cloud_firestore_platform_interface/lib/cloud_firestore_platform_interface.dart

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export 'src/field_path.dart';
1515
export 'src/geo_point.dart';
1616
export 'src/get_options.dart';
1717
export 'src/load_bundle_task_state.dart';
18-
export 'src/load_bundle_task_state.dart';
1918
export 'src/persistence_settings.dart';
2019
export 'src/platform_interface/platform_interface_aggregate_query.dart';
2120
export 'src/platform_interface/platform_interface_aggregate_query_snapshot.dart';
@@ -28,8 +27,6 @@ export 'src/platform_interface/platform_interface_field_value_factory.dart';
2827
export 'src/platform_interface/platform_interface_firestore.dart';
2928
export 'src/platform_interface/platform_interface_index_definitions.dart';
3029
export 'src/platform_interface/platform_interface_load_bundle_task.dart';
31-
export 'src/platform_interface/platform_interface_load_bundle_task.dart';
32-
export 'src/platform_interface/platform_interface_load_bundle_task_snapshot.dart';
3330
export 'src/platform_interface/platform_interface_load_bundle_task_snapshot.dart';
3431
export 'src/platform_interface/platform_interface_query.dart';
3532
export 'src/platform_interface/platform_interface_query_snapshot.dart';

Diff for: packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/settings.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ class Settings {
100100
);
101101

102102
@override
103-
String toString() => 'Settings(${asMap.toString()})';
103+
String toString() => 'Settings($asMap)';
104104
}

Diff for: packages/cloud_firestore/cloud_firestore_web/lib/src/interop/firestore_interop.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ abstract class FirestoreJsImpl {
239239

240240
// TODO how?
241241
// external void settings(Settings settings);
242-
243242
}
244243

245244
@JS('WriteBatch')
@@ -480,7 +479,8 @@ abstract class TimestampJsImpl {
480479
@anonymous
481480
@JS()
482481
abstract class FirestoreError {
483-
external String /*|'cancelled'|'unknown'|'invalid-argument'|'deadline-exceeded'|'not-found'|'already-exists'|'permission-denied'|'resource-exhausted'|'failed-precondition'|'aborted'|'out-of-range'|'unimplemented'|'internal'|'unavailable'|'data-loss'|'unauthenticated'*/ get code;
482+
external String /*|'cancelled'|'unknown'|'invalid-argument'|'deadline-exceeded'|'not-found'|'already-exists'|'permission-denied'|'resource-exhausted'|'failed-precondition'|'aborted'|'out-of-range'|'unimplemented'|'internal'|'unavailable'|'data-loss'|'unauthenticated'*/
483+
get code;
484484

485485
external set code(
486486
/*|'cancelled'|'unknown'|'invalid-argument'|'deadline-exceeded'|'not-found'|'already-exists'|'permission-denied'|'resource-exhausted'|'failed-precondition'|'aborted'|'out-of-range'|'unimplemented'|'internal'|'unavailable'|'data-loss'|'unauthenticated'*/

Diff for: packages/cloud_firestore_odm/analysis_options.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ linter:
7474
# and `@required Widget child` last.
7575
always_put_required_named_parameters_first: false
7676

77-
# `as` is not that bad (especially with the upcoming non-nullable types).
78-
# Explicit exceptions is better than implicit exceptions.
79-
avoid_as: false
80-
8177
# This project doesn't use Flutter-style todos
8278
flutter_style_todos: false
8379

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm/example/lib/integration.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AdvancedJson {
4444
@JsonKey(name: 'LAST_NAME')
4545
final String? lastName;
4646

47-
@JsonKey(ignore: true)
47+
@JsonKey(includeFromJson: false, includeToJson: false)
4848
final String? ignored;
4949

5050
Map<String, Object?> toJson() => _$AdvancedJsonToJson(this);
@@ -77,7 +77,7 @@ class _PrivateAdvancedJson {
7777
@JsonKey(name: 'LAST_NAME')
7878
final String? lastName;
7979

80-
@JsonKey(ignore: true)
80+
@JsonKey(includeFromJson: false, includeToJson: false)
8181
final String? ignored;
8282

8383
Map<String, Object?> toJson() => _$PrivateAdvancedJsonToJson(this);

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm/example/lib/movies_screen.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class _FilmListState extends State<FilmList> {
7272
builder: (context, _) {
7373
return Text(
7474
'Latest Snapshot: ${DateTime.now()}',
75-
style: Theme.of(context).textTheme.caption,
75+
style: Theme.of(context).textTheme.bodySmall,
7676
);
7777
},
7878
)

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:cloud_firestore/cloud_firestore.dart';
66
import 'package:cloud_firestore_odm/cloud_firestore_odm.dart';
77
import 'package:json_annotation/json_annotation.dart';
8+
89
import 'model.dart';
910

1011
part 'simple.g.dart';
@@ -20,10 +21,10 @@ class IgnoredGetter {
2021

2122
int get count => 42;
2223

23-
@JsonKey(ignore: true)
24+
@JsonKey(includeFromJson: false, includeToJson: false)
2425
int get count2 => 42;
2526

26-
@JsonKey(ignore: false)
27+
@JsonKey(includeFromJson: true, includeToJson: true)
2728
int get count3 => 42;
2829
}
2930

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/collection_data.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class CollectionData with Names {
116116
final type = CollectionData.modelTypeOfAnnotation(annotation);
117117

118118
final hasJsonSerializable =
119-
jsonSerializableChecker.hasAnnotationOf(type.element2!);
119+
jsonSerializableChecker.hasAnnotationOf(type.element!);
120120

121121
if (type.isDynamic) {
122122
throw InvalidGenerationSourceError(
@@ -126,15 +126,15 @@ class CollectionData with Names {
126126
);
127127
}
128128

129-
final collectionTargetElement = type.element2;
129+
final collectionTargetElement = type.element;
130130
if (collectionTargetElement is! ClassElement) {
131131
throw InvalidGenerationSourceError(
132132
'The annotation @Collection can only receive classes as generic argument. ',
133133
element: annotatedElement,
134134
);
135135
}
136136

137-
final hasFreezed = freezedChecker.hasAnnotationOf(type.element2!);
137+
final hasFreezed = freezedChecker.hasAnnotationOf(type.element!);
138138
final redirectedFreezedConstructors =
139139
collectionTargetElement.constructors.where(
140140
(element) {
@@ -272,7 +272,7 @@ represents the content of the collection must be in the same file.
272272
if (hasFreezed) {
273273
key =
274274
// two $ because both Freezed and json_serializable add one
275-
'_\$\$${redirectedFreezedConstructors.single.redirectedConstructor!.enclosingElement3.name}FieldMap[$key]!';
275+
'_\$\$${redirectedFreezedConstructors.single.redirectedConstructor!.enclosingElement.name}FieldMap[$key]!';
276276
} else if (hasJsonSerializable) {
277277
key = '_\$${collectionTargetElement.name.public}FieldMap[$key]!';
278278
}
@@ -411,7 +411,7 @@ extension on ClassElement {
411411
for (final supertype in allSupertypes) {
412412
if (supertype.isDartCoreObject) continue;
413413

414-
for (final field in supertype.element2.fields) {
414+
for (final field in supertype.element.fields) {
415415
if (field.getter != null && !field.getter!.isSynthetic) {
416416
continue;
417417
}
@@ -431,10 +431,10 @@ extension on String {
431431

432432
extension on DartType {
433433
bool get isJsonDocumentReference {
434-
return element2?.librarySource?.uri.scheme == 'package' &&
434+
return element?.librarySource?.uri.scheme == 'package' &&
435435
const {'cloud_firestore'}
436-
.contains(element2?.librarySource?.uri.pathSegments.first) &&
437-
element2?.name == 'DocumentReference' &&
436+
.contains(element?.librarySource?.uri.pathSegments.first) &&
437+
element?.name == 'DocumentReference' &&
438438
(this as InterfaceType).typeArguments.single.isDartCoreMap;
439439
}
440440

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class ${data.queryReferenceImplName}
449449

450450
extension on TypeProvider {
451451
DartType asNullable(DartType type) {
452-
final typeSystem = nullType.element2.library.typeSystem;
452+
final typeSystem = nullType.element.library.typeSystem;
453453
if (typeSystem.isNullable(type)) return type;
454454

455455
return typeSystem.leastUpperBound(type, nullType);

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/validator_generator.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ bool isValidatorAnnotation(ElementAnnotation annotation) {
4040
final element = annotation.element;
4141
if (element == null || element is! ConstructorElement) return false;
4242

43-
return element.enclosingElement3.allSupertypes.any((superType) {
44-
return superType.element2.name == 'Validator' &&
45-
superType.element2.librarySource.uri.toString() ==
43+
return element.enclosingElement.allSupertypes.any((superType) {
44+
return superType.element.name == 'Validator' &&
45+
superType.element.librarySource.uri.toString() ==
4646
'package:cloud_firestore_odm/src/validator.dart';
4747
});
4848
}

Diff for: packages/cloud_firestore_odm/cloud_firestore_odm_generator/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
sdk: ">=2.17.0 <3.0.0"
99

1010
dependencies:
11-
analyzer: ">=4.6.0 <6.0.0"
11+
analyzer: ">=5.4.0 <6.0.0"
1212
build: ^2.0.1
1313
build_config: ^1.0.0
1414
cloud_firestore_odm: ^1.0.0-dev.45

Diff for: packages/cloud_functions/cloud_functions/example/macos/Runner.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@
409409
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
410410
GCC_WARN_UNUSED_FUNCTION = YES;
411411
GCC_WARN_UNUSED_VARIABLE = YES;
412-
MACOSX_DEPLOYMENT_TARGET = 10.12;
412+
MACOSX_DEPLOYMENT_TARGET = 10.14;
413413
MTL_ENABLE_DEBUG_INFO = NO;
414414
SDKROOT = macosx;
415415
SWIFT_COMPILATION_MODE = wholemodule;
@@ -494,7 +494,7 @@
494494
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
495495
GCC_WARN_UNUSED_FUNCTION = YES;
496496
GCC_WARN_UNUSED_VARIABLE = YES;
497-
MACOSX_DEPLOYMENT_TARGET = 10.12;
497+
MACOSX_DEPLOYMENT_TARGET = 10.14;
498498
MTL_ENABLE_DEBUG_INFO = YES;
499499
ONLY_ACTIVE_ARCH = YES;
500500
SDKROOT = macosx;
@@ -541,7 +541,7 @@
541541
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
542542
GCC_WARN_UNUSED_FUNCTION = YES;
543543
GCC_WARN_UNUSED_VARIABLE = YES;
544-
MACOSX_DEPLOYMENT_TARGET = 10.12;
544+
MACOSX_DEPLOYMENT_TARGET = 10.14;
545545
MTL_ENABLE_DEBUG_INFO = NO;
546546
SDKROOT = macosx;
547547
SWIFT_COMPILATION_MODE = wholemodule;

Diff for: packages/firebase_analytics/firebase_analytics/example/macos/Runner.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
408408
GCC_WARN_UNUSED_FUNCTION = YES;
409409
GCC_WARN_UNUSED_VARIABLE = YES;
410-
MACOSX_DEPLOYMENT_TARGET = 10.12;
410+
MACOSX_DEPLOYMENT_TARGET = 10.14;
411411
MTL_ENABLE_DEBUG_INFO = NO;
412412
SDKROOT = macosx;
413413
SWIFT_COMPILATION_MODE = wholemodule;
@@ -487,7 +487,7 @@
487487
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
488488
GCC_WARN_UNUSED_FUNCTION = YES;
489489
GCC_WARN_UNUSED_VARIABLE = YES;
490-
MACOSX_DEPLOYMENT_TARGET = 10.12;
490+
MACOSX_DEPLOYMENT_TARGET = 10.14;
491491
MTL_ENABLE_DEBUG_INFO = YES;
492492
ONLY_ACTIVE_ARCH = YES;
493493
SDKROOT = macosx;
@@ -534,7 +534,7 @@
534534
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
535535
GCC_WARN_UNUSED_FUNCTION = YES;
536536
GCC_WARN_UNUSED_VARIABLE = YES;
537-
MACOSX_DEPLOYMENT_TARGET = 10.12;
537+
MACOSX_DEPLOYMENT_TARGET = 10.14;
538538
MTL_ENABLE_DEBUG_INFO = NO;
539539
SDKROOT = macosx;
540540
SWIFT_COMPILATION_MODE = wholemodule;

Diff for: packages/firebase_app_installations/firebase_app_installations/example/macos/Runner.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
408408
GCC_WARN_UNUSED_FUNCTION = YES;
409409
GCC_WARN_UNUSED_VARIABLE = YES;
410-
MACOSX_DEPLOYMENT_TARGET = 10.12;
410+
MACOSX_DEPLOYMENT_TARGET = 10.14;
411411
MTL_ENABLE_DEBUG_INFO = NO;
412412
SDKROOT = macosx;
413413
SWIFT_COMPILATION_MODE = wholemodule;
@@ -487,7 +487,7 @@
487487
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
488488
GCC_WARN_UNUSED_FUNCTION = YES;
489489
GCC_WARN_UNUSED_VARIABLE = YES;
490-
MACOSX_DEPLOYMENT_TARGET = 10.12;
490+
MACOSX_DEPLOYMENT_TARGET = 10.14;
491491
MTL_ENABLE_DEBUG_INFO = YES;
492492
ONLY_ACTIVE_ARCH = YES;
493493
SDKROOT = macosx;
@@ -534,7 +534,7 @@
534534
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
535535
GCC_WARN_UNUSED_FUNCTION = YES;
536536
GCC_WARN_UNUSED_VARIABLE = YES;
537-
MACOSX_DEPLOYMENT_TARGET = 10.12;
537+
MACOSX_DEPLOYMENT_TARGET = 10.14;
538538
MTL_ENABLE_DEBUG_INFO = NO;
539539
SDKROOT = macosx;
540540
SWIFT_COMPILATION_MODE = wholemodule;

0 commit comments

Comments
 (0)