Skip to content

Commit

Permalink
[various] Align Flutter and Dart SDK constraints (flutter#3349)
Browse files Browse the repository at this point in the history
As described in flutter/flutter#121684, we currently have inconsistencies between Flutter SDK constraints and Dart SDK constraints; we have often updated only the former. This PR:
1. Adds CI enforcement via the repo tooling that the minimum versions are consistent.
2. Adds a new repo tooling command to update SDK constraints, to help mass-fix all the violations of the new enforcement in step 1 (and for future mass changes, such as when we update our test matrix and mass-drop support for versions that are no longe tested).
    - In all cases, the looser constraint was updated to match the more restrictive constraint, such that there's no actual change in what Flutter version any package actually supports.
3. Runs `dart fix --apply` over all changed packages to automatically fix all of the analysis failures caused by step 2 suddenly making all of our packages able to use `super` parameters.

Fixes flutter/flutter#121684
Fixes flutter/flutter#121685
  • Loading branch information
stuartmorgan committed Mar 4, 2023
1 parent f14fae7 commit 789e3a7
Show file tree
Hide file tree
Showing 496 changed files with 1,363 additions and 838 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Expand Up @@ -95,9 +95,9 @@ task:
always:
format_script: ./script/tool_runner.sh format --fail-on-change
license_script: $PLUGIN_TOOL_COMMAND license-check
# The major and minor versions here should match the lowest version
# The major and minor version here should match the lowest version
# analyzed in legacy_version_analyze.
pubspec_script: ./script/tool_runner.sh pubspec-check --min-min-flutter-version=3.0.0 --min-min-dart-version=2.17.0
pubspec_script: ./script/tool_runner.sh pubspec-check --min-min-flutter-version=3.0.0
readme_script:
- ./script/tool_runner.sh readme-check
# Re-run with --require-excerpts, skipping packages that still need
Expand Down
4 changes: 4 additions & 0 deletions packages/animations/CHANGELOG.md
@@ -1,3 +1,7 @@
## NEXT

* Aligns Dart and Flutter SDK constraints.

## 2.0.7
* Updates screenshots to use webp compressed animations

Expand Down
2 changes: 1 addition & 1 deletion packages/animations/example/lib/container_transition.dart
Expand Up @@ -41,7 +41,7 @@ const double _fabDimension = 56.0;
/// The demo page for [OpenContainerTransform].
class OpenContainerTransformDemo extends StatefulWidget {
/// Creates the demo page for [OpenContainerTransform].
const OpenContainerTransformDemo({Key? key}) : super(key: key);
const OpenContainerTransformDemo({super.key});

@override
State<OpenContainerTransformDemo> createState() {
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/example/lib/fade_scale_transition.dart
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
/// The demo page for [FadeScaleTransition].
class FadeScaleTransitionDemo extends StatefulWidget {
/// Creates the demo page for [FadeScaleTransition].
const FadeScaleTransitionDemo({Key? key}) : super(key: key);
const FadeScaleTransitionDemo({super.key});

@override
State<FadeScaleTransitionDemo> createState() =>
Expand Down
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
/// The demo page for [FadeThroughTransition].
class FadeThroughTransitionDemo extends StatefulWidget {
/// Creates the demo page for [FadeThroughTransition].
const FadeThroughTransitionDemo({Key? key}) : super(key: key);
const FadeThroughTransitionDemo({super.key});

@override
State<FadeThroughTransitionDemo> createState() =>
Expand Down
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
/// The demo page for [SharedAxisPageTransitionsBuilder].
class SharedAxisTransitionDemo extends StatefulWidget {
/// Creates the demo page for [SharedAxisPageTransitionsBuilder].
const SharedAxisTransitionDemo({Key? key}) : super(key: key);
const SharedAxisTransitionDemo({super.key});

@override
State<SharedAxisTransitionDemo> createState() {
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/example/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: none
version: 0.0.1

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

dependencies:
Expand Down
22 changes: 8 additions & 14 deletions packages/animations/lib/src/fade_scale_transition.dart
Expand Up @@ -65,18 +65,12 @@ class FadeScaleTransitionConfiguration extends ModalConfiguration {
/// a dismissible barrier. [barrierDismissible] cannot be null. If
/// [barrierDismissible] is true, the [barrierLabel] cannot be null.
const FadeScaleTransitionConfiguration({
Color barrierColor = Colors.black54,
bool barrierDismissible = true,
Duration transitionDuration = const Duration(milliseconds: 150),
Duration reverseTransitionDuration = const Duration(milliseconds: 75),
String barrierLabel = 'Dismiss',
}) : super(
barrierColor: barrierColor,
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
transitionDuration: transitionDuration,
reverseTransitionDuration: reverseTransitionDuration,
);
super.barrierColor = Colors.black54,
super.barrierDismissible = true,
super.transitionDuration = const Duration(milliseconds: 150),
super.reverseTransitionDuration = const Duration(milliseconds: 75),
String super.barrierLabel = 'Dismiss',
});

@override
Widget transitionBuilder(
Expand Down Expand Up @@ -115,10 +109,10 @@ class FadeScaleTransition extends StatelessWidget {
/// [animation] is typically an [AnimationController] that drives the transition
/// animation. [animation] cannot be null.
const FadeScaleTransition({
Key? key,
super.key,
required this.animation,
this.child,
}) : super(key: key);
});

/// The animation that drives the [child]'s entrance and exit.
///
Expand Down
7 changes: 3 additions & 4 deletions packages/animations/lib/src/fade_through_transition.dart
Expand Up @@ -162,12 +162,12 @@ class FadeThroughTransition extends StatelessWidget {
/// The [animation] and [secondaryAnimation] argument are required and must
/// not be null.
const FadeThroughTransition({
Key? key,
super.key,
required this.animation,
required this.secondaryAnimation,
this.fillColor,
this.child,
}) : super(key: key);
});

/// The animation that drives the [child]'s entrance and exit.
///
Expand Down Expand Up @@ -213,8 +213,7 @@ class FadeThroughTransition extends StatelessWidget {
}

class _ZoomedFadeInFadeOut extends StatelessWidget {
const _ZoomedFadeInFadeOut({Key? key, required this.animation, this.child})
: super(key: key);
const _ZoomedFadeInFadeOut({required this.animation, this.child});

final Animation<double> animation;
final Widget? child;
Expand Down
4 changes: 2 additions & 2 deletions packages/animations/lib/src/modal.dart
Expand Up @@ -98,10 +98,10 @@ class _ModalRoute<T> extends PopupRoute<T> {
required _ModalTransitionBuilder transitionBuilder,
required this.builder,
RouteSettings? routeSettings,
ui.ImageFilter? filter,
super.filter,
}) : assert(!barrierDismissible || barrierLabel != null),
_transitionBuilder = transitionBuilder,
super(filter: filter, settings: routeSettings);
super(settings: routeSettings);

@override
final Color? barrierColor;
Expand Down
8 changes: 4 additions & 4 deletions packages/animations/lib/src/open_container.dart
Expand Up @@ -80,7 +80,7 @@ class OpenContainer<T extends Object?> extends StatefulWidget {
/// All arguments except for [key] must not be null. The arguments
/// [openBuilder] and [closedBuilder] are required.
const OpenContainer({
Key? key,
super.key,
this.closedColor = Colors.white,
this.openColor = Colors.white,
this.middleColor,
Expand All @@ -99,7 +99,7 @@ class OpenContainer<T extends Object?> extends StatefulWidget {
this.useRootNavigator = false,
this.routeSettings,
this.clipBehavior = Clip.antiAlias,
}) : super(key: key);
});

/// Background color of the container while it is closed.
///
Expand Down Expand Up @@ -341,9 +341,9 @@ class _OpenContainerState<T> extends State<OpenContainer<T?>> {
/// `isVisible` is ignored).
class _Hideable extends StatefulWidget {
const _Hideable({
Key? key,
super.key,
required this.child,
}) : super(key: key);
});

final Widget child;

Expand Down
4 changes: 2 additions & 2 deletions packages/animations/lib/src/page_transition_switcher.dart
Expand Up @@ -168,13 +168,13 @@ class PageTransitionSwitcher extends StatefulWidget {
/// The [duration], [reverse], and [transitionBuilder] parameters
/// must not be null.
const PageTransitionSwitcher({
Key? key,
super.key,
this.duration = const Duration(milliseconds: 300),
this.reverse = false,
required this.transitionBuilder,
this.layoutBuilder = defaultLayoutBuilder,
this.child,
}) : super(key: key);
});

/// The current child widget to display.
///
Expand Down
8 changes: 4 additions & 4 deletions packages/animations/lib/src/shared_axis_transition.dart
Expand Up @@ -184,13 +184,13 @@ class SharedAxisTransition extends StatelessWidget {
/// The [animation] and [secondaryAnimation] argument are required and must
/// not be null.
const SharedAxisTransition({
Key? key,
super.key,
required this.animation,
required this.secondaryAnimation,
required this.transitionType,
this.fillColor,
this.child,
}) : super(key: key);
});

/// The animation that drives the [child]'s entrance and exit.
///
Expand Down Expand Up @@ -472,8 +472,8 @@ class _ExitTransition extends StatelessWidget {
class _FlippedCurveTween extends CurveTween {
/// Creates a vertically flipped [CurveTween].
_FlippedCurveTween({
required Curve curve,
}) : super(curve: curve);
required super.curve,
});

@override
double transform(double t) => 1.0 - super.transform(t);
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/pubspec.yaml
Expand Up @@ -5,7 +5,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+
version: 2.0.7

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/test/dual_transition_builder_test.dart
Expand Up @@ -281,7 +281,7 @@ double _getOpacity(WidgetTester tester) {
}

class _StatefulTestWidget extends StatefulWidget {
const _StatefulTestWidget({Key? key, required this.name}) : super(key: key);
const _StatefulTestWidget({required this.name});

final String name;

Expand Down
4 changes: 2 additions & 2 deletions packages/animations/test/fade_scale_transition_test.dart
Expand Up @@ -466,9 +466,9 @@ double _getScale(GlobalKey key, WidgetTester tester) {

class _FlutterLogoModal extends StatefulWidget {
const _FlutterLogoModal({
Key? key,
super.key,
this.name,
}) : super(key: key);
});

final String? name;

Expand Down
2 changes: 1 addition & 1 deletion packages/animations/test/fade_through_transition_test.dart
Expand Up @@ -487,7 +487,7 @@ class _TestWidget extends StatelessWidget {
}

class _StatefulTestWidget extends StatefulWidget {
const _StatefulTestWidget({Key? key, this.name}) : super(key: key);
const _StatefulTestWidget({super.key, this.name});

final String? name;

Expand Down
23 changes: 9 additions & 14 deletions packages/animations/test/modal_test.dart
Expand Up @@ -565,9 +565,9 @@ double _getScale(GlobalKey key, WidgetTester tester) {

class _FlutterLogoModal extends StatefulWidget {
const _FlutterLogoModal({
Key? key,
super.key,
this.name,
}) : super(key: key);
});

final String? name;

Expand All @@ -593,18 +593,13 @@ class _FlutterLogoModalState extends State<_FlutterLogoModal> {
}

class _TestModalConfiguration extends ModalConfiguration {
_TestModalConfiguration({
Color barrierColor = Colors.green,
bool barrierDismissible = true,
String barrierLabel = 'customLabel',
Duration transitionDuration = const Duration(milliseconds: 300),
Duration reverseTransitionDuration = const Duration(milliseconds: 200),
}) : super(
barrierColor: barrierColor,
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
transitionDuration: transitionDuration,
reverseTransitionDuration: reverseTransitionDuration,
_TestModalConfiguration()
: super(
barrierColor: Colors.green,
barrierDismissible: true,
barrierLabel: 'customLabel',
transitionDuration: const Duration(milliseconds: 300),
reverseTransitionDuration: const Duration(milliseconds: 200),
);

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/test/open_container_test.dart
Expand Up @@ -1933,7 +1933,7 @@ class __RemoveOpenContainerExampleState
}

class DummyStatefulWidget extends StatefulWidget {
const DummyStatefulWidget({Key? key}) : super(key: key);
const DummyStatefulWidget({super.key});

@override
State<StatefulWidget> createState() => DummyState();
Expand Down
Expand Up @@ -581,7 +581,7 @@ void main() {
}

class StatefulTestWidget extends StatefulWidget {
const StatefulTestWidget({Key? key}) : super(key: key);
const StatefulTestWidget({super.key});

@override
StatefulTestWidgetState createState() => StatefulTestWidgetState();
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/test/shared_axis_transition_test.dart
Expand Up @@ -1931,7 +1931,7 @@ class _TestWidget extends StatelessWidget {
}

class _StatefulTestWidget extends StatefulWidget {
const _StatefulTestWidget({Key? key, required this.name}) : super(key: key);
const _StatefulTestWidget({super.key, required this.name});

final String name;

Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
@@ -1,3 +1,7 @@
## NEXT

* Aligns Dart and Flutter SDK constraints.

## 0.10.3+2

* Updates iOS minimum version in README.
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/README.md
Expand Up @@ -114,7 +114,7 @@ Future<void> main() async {
/// CameraApp is the Main Application.
class CameraApp extends StatefulWidget {
/// Default Constructor
const CameraApp({Key? key}) : super(key: key);
const CameraApp({super.key});
@override
State<CameraApp> createState() => _CameraAppState();
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera/example/lib/main.dart
Expand Up @@ -14,7 +14,7 @@ import 'package:video_player/video_player.dart';
/// Camera example home widget.
class CameraExampleHome extends StatefulWidget {
/// Default Constructor
const CameraExampleHome({Key? key}) : super(key: key);
const CameraExampleHome({super.key});

@override
State<CameraExampleHome> createState() {
Expand Down Expand Up @@ -1056,7 +1056,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
/// CameraApp is the Main Application.
class CameraApp extends StatelessWidget {
/// Default Constructor
const CameraApp({Key? key}) : super(key: key);
const CameraApp({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ Future<void> main() async {
/// CameraApp is the Main Application.
class CameraApp extends StatefulWidget {
/// Default Constructor
const CameraApp({Key? key}) : super(key: key);
const CameraApp({super.key});

@override
State<CameraApp> createState() => _CameraAppState();
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/example/pubspec.yaml
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the camera plugin.
publish_to: none

environment:
sdk: ">=2.14.0 <3.0.0"
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

dependencies:
Expand Down
3 changes: 1 addition & 2 deletions packages/camera/camera/lib/src/camera_preview.dart
Expand Up @@ -11,8 +11,7 @@ import '../camera.dart';
/// A widget showing a live camera preview.
class CameraPreview extends StatelessWidget {
/// Creates a preview widget for the given camera controller.
const CameraPreview(this.controller, {Key? key, this.child})
: super(key: key);
const CameraPreview(this.controller, {super.key, this.child});

/// The controller for the camera that the preview is shown for.
final CameraController controller;
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Expand Up @@ -7,7 +7,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+
version: 0.10.3+2

environment:
sdk: ">=2.14.0 <3.0.0"
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

flutter:
Expand Down
1 change: 1 addition & 0 deletions packages/camera/camera_android/CHANGELOG.md
@@ -1,5 +1,6 @@
## NEXT

* Aligns Dart and Flutter SDK constraints.
* Updates compileSdkVersion to 33.

## 0.10.4+1
Expand Down

0 comments on commit 789e3a7

Please sign in to comment.