Unverified Commit da0f9a99 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Enable private field promotion for framework (#134473)

New feature in upcoming Dart 3.2. See https://github.com/dart-lang/language/issues/2020. Feature is enabled by bumping the min SDK version to 3.2.

Part of https://github.com/flutter/flutter/issues/134476.
parent 2396a417
...@@ -1126,7 +1126,7 @@ class CupertinoDynamicColor extends Color with Diagnosticable { ...@@ -1126,7 +1126,7 @@ class CupertinoDynamicColor extends Color with Diagnosticable {
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties); super.debugFillProperties(properties);
if (_debugLabel != null) { if (_debugLabel != null) {
properties.add(MessageProperty('debugLabel', _debugLabel!)); properties.add(MessageProperty('debugLabel', _debugLabel));
} }
properties.add(createCupertinoColorProperty('color', color)); properties.add(createCupertinoColorProperty('color', color));
if (_isPlatformBrightnessDependent) { if (_isPlatformBrightnessDependent) {
......
...@@ -845,16 +845,16 @@ class _CupertinoEdgeShadowDecoration extends Decoration { ...@@ -845,16 +845,16 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
return b!._colors == null ? b : _CupertinoEdgeShadowDecoration._(b._colors!.map<Color>((Color color) => Color.lerp(null, color, t)!).toList()); return b!._colors == null ? b : _CupertinoEdgeShadowDecoration._(b._colors!.map<Color>((Color color) => Color.lerp(null, color, t)!).toList());
} }
if (b == null) { if (b == null) {
return a._colors == null ? a : _CupertinoEdgeShadowDecoration._(a._colors!.map<Color>((Color color) => Color.lerp(null, color, 1.0 - t)!).toList()); return a._colors == null ? a : _CupertinoEdgeShadowDecoration._(a._colors.map<Color>((Color color) => Color.lerp(null, color, 1.0 - t)!).toList());
} }
assert(b._colors != null || a._colors != null); assert(b._colors != null || a._colors != null);
// If it ever becomes necessary, we could allow decorations with different // If it ever becomes necessary, we could allow decorations with different
// length' here, similarly to how it is handled in [LinearGradient.lerp]. // length' here, similarly to how it is handled in [LinearGradient.lerp].
assert(b._colors == null || a._colors == null || a._colors!.length == b._colors!.length); assert(b._colors == null || a._colors == null || a._colors.length == b._colors.length);
return _CupertinoEdgeShadowDecoration._( return _CupertinoEdgeShadowDecoration._(
<Color>[ <Color>[
for (int i = 0; i < b._colors!.length; i += 1) for (int i = 0; i < b._colors!.length; i += 1)
Color.lerp(a._colors?[i], b._colors?[i], t)!, Color.lerp(a._colors?[i], b._colors[i], t)!,
], ],
); );
} }
...@@ -904,7 +904,7 @@ class _CupertinoEdgeShadowPainter extends BoxPainter { ...@@ -904,7 +904,7 @@ class _CupertinoEdgeShadowPainter extends BoxPainter {
_CupertinoEdgeShadowPainter( _CupertinoEdgeShadowPainter(
this._decoration, this._decoration,
super.onChanged, super.onChanged,
) : assert(_decoration._colors == null || _decoration._colors!.length > 1); ) : assert(_decoration._colors == null || _decoration._colors.length > 1);
final _CupertinoEdgeShadowDecoration _decoration; final _CupertinoEdgeShadowDecoration _decoration;
......
...@@ -2673,7 +2673,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode { ...@@ -2673,7 +2673,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
@override @override
String toDescription({ TextTreeConfiguration? parentConfiguration }) { String toDescription({ TextTreeConfiguration? parentConfiguration }) {
if (_description != null) { if (_description != null) {
return _addTooltip(_description!); return _addTooltip(_description);
} }
if (exception != null) { if (exception != null) {
......
...@@ -53,7 +53,7 @@ class PersistentHashMap<K extends Object, V> { ...@@ -53,7 +53,7 @@ class PersistentHashMap<K extends Object, V> {
// Unfortunately can not use unsafeCast<V?>(...) here because it leads // Unfortunately can not use unsafeCast<V?>(...) here because it leads
// to worse code generation on VM. // to worse code generation on VM.
return _root!.get(0, key, key.hashCode) as V?; return _root.get(0, key, key.hashCode) as V?;
} }
} }
......
...@@ -249,7 +249,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -249,7 +249,7 @@ class ButtonThemeData with Diagnosticable {
/// child (typically the button's label). /// child (typically the button's label).
EdgeInsetsGeometry get padding { EdgeInsetsGeometry get padding {
if (_padding != null) { if (_padding != null) {
return _padding!; return _padding;
} }
switch (textTheme) { switch (textTheme) {
case ButtonTextTheme.normal: case ButtonTextTheme.normal:
...@@ -277,7 +277,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -277,7 +277,7 @@ class ButtonThemeData with Diagnosticable {
/// [Material]. /// [Material].
ShapeBorder get shape { ShapeBorder get shape {
if (_shape != null) { if (_shape != null) {
return _shape!; return _shape;
} }
switch (textTheme) { switch (textTheme) {
case ButtonTextTheme.normal: case ButtonTextTheme.normal:
...@@ -537,7 +537,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -537,7 +537,7 @@ class ButtonThemeData with Diagnosticable {
switch (getTextTheme(button)) { switch (getTextTheme(button)) {
case ButtonTextTheme.normal: case ButtonTextTheme.normal:
case ButtonTextTheme.accent: case ButtonTextTheme.accent:
return _splashColor!; return _splashColor;
case ButtonTextTheme.primary: case ButtonTextTheme.primary:
break; break;
} }
...@@ -642,7 +642,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -642,7 +642,7 @@ class ButtonThemeData with Diagnosticable {
} }
if (_padding != null) { if (_padding != null) {
return _padding!; return _padding;
} }
switch (getTextTheme(button)) { switch (getTextTheme(button)) {
......
...@@ -130,7 +130,7 @@ class InkHighlight extends InteractiveInkFeature { ...@@ -130,7 +130,7 @@ class InkHighlight extends InteractiveInkFeature {
void paintFeature(Canvas canvas, Matrix4 transform) { void paintFeature(Canvas canvas, Matrix4 transform) {
final Paint paint = Paint()..color = color.withAlpha(_alpha.value); final Paint paint = Paint()..color = color.withAlpha(_alpha.value);
final Offset? originOffset = MatrixUtils.getAsTranslation(transform); final Offset? originOffset = MatrixUtils.getAsTranslation(transform);
final Rect rect = _rectCallback != null ? _rectCallback!() : Offset.zero & referenceBox.size; final Rect rect = _rectCallback != null ? _rectCallback() : Offset.zero & referenceBox.size;
if (originOffset == null) { if (originOffset == null) {
canvas.save(); canvas.save();
canvas.transform(transform.storage); canvas.transform(transform.storage);
......
...@@ -228,7 +228,7 @@ class InkRipple extends InteractiveInkFeature { ...@@ -228,7 +228,7 @@ class InkRipple extends InteractiveInkFeature {
final Paint paint = Paint()..color = color.withAlpha(alpha); final Paint paint = Paint()..color = color.withAlpha(alpha);
Rect? rect; Rect? rect;
if (_clipCallback != null) { if (_clipCallback != null) {
rect = _clipCallback!(); rect = _clipCallback();
} }
// Splash moves to the center of the reference box. // Splash moves to the center of the reference box.
final Offset center = Offset.lerp( final Offset center = Offset.lerp(
......
...@@ -285,7 +285,7 @@ class InkSparkle extends InteractiveInkFeature { ...@@ -285,7 +285,7 @@ class InkSparkle extends InteractiveInkFeature {
if (_clipCallback != null) { if (_clipCallback != null) {
_clipCanvas( _clipCanvas(
canvas: canvas, canvas: canvas,
clipCallback: _clipCallback!, clipCallback: _clipCallback,
textDirection: _textDirection, textDirection: _textDirection,
customBorder: customBorder, customBorder: customBorder,
borderRadius: _borderRadius, borderRadius: _borderRadius,
...@@ -296,7 +296,7 @@ class InkSparkle extends InteractiveInkFeature { ...@@ -296,7 +296,7 @@ class InkSparkle extends InteractiveInkFeature {
final Paint paint = Paint()..shader = _fragmentShader; final Paint paint = Paint()..shader = _fragmentShader;
if (_clipCallback != null) { if (_clipCallback != null) {
canvas.drawRect(_clipCallback!(), paint); canvas.drawRect(_clipCallback(), paint);
} else { } else {
canvas.drawPaint(paint); canvas.drawPaint(paint);
} }
......
...@@ -378,79 +378,79 @@ class ListTileTheme extends InheritedTheme { ...@@ -378,79 +378,79 @@ class ListTileTheme extends InheritedTheme {
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.dense] property instead. /// [ListTileThemeData.dense] property instead.
bool? get dense => _data != null ? _data!.dense : _dense; bool? get dense => _data != null ? _data.dense : _dense;
/// Overrides the default value of [ListTile.shape]. /// Overrides the default value of [ListTile.shape].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.shape] property instead. /// [ListTileThemeData.shape] property instead.
ShapeBorder? get shape => _data != null ? _data!.shape : _shape; ShapeBorder? get shape => _data != null ? _data.shape : _shape;
/// Overrides the default value of [ListTile.style]. /// Overrides the default value of [ListTile.style].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.style] property instead. /// [ListTileThemeData.style] property instead.
ListTileStyle? get style => _data != null ? _data!.style : _style; ListTileStyle? get style => _data != null ? _data.style : _style;
/// Overrides the default value of [ListTile.selectedColor]. /// Overrides the default value of [ListTile.selectedColor].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.selectedColor] property instead. /// [ListTileThemeData.selectedColor] property instead.
Color? get selectedColor => _data != null ? _data!.selectedColor : _selectedColor; Color? get selectedColor => _data != null ? _data.selectedColor : _selectedColor;
/// Overrides the default value of [ListTile.iconColor]. /// Overrides the default value of [ListTile.iconColor].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.iconColor] property instead. /// [ListTileThemeData.iconColor] property instead.
Color? get iconColor => _data != null ? _data!.iconColor : _iconColor; Color? get iconColor => _data != null ? _data.iconColor : _iconColor;
/// Overrides the default value of [ListTile.textColor]. /// Overrides the default value of [ListTile.textColor].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.textColor] property instead. /// [ListTileThemeData.textColor] property instead.
Color? get textColor => _data != null ? _data!.textColor : _textColor; Color? get textColor => _data != null ? _data.textColor : _textColor;
/// Overrides the default value of [ListTile.contentPadding]. /// Overrides the default value of [ListTile.contentPadding].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.contentPadding] property instead. /// [ListTileThemeData.contentPadding] property instead.
EdgeInsetsGeometry? get contentPadding => _data != null ? _data!.contentPadding : _contentPadding; EdgeInsetsGeometry? get contentPadding => _data != null ? _data.contentPadding : _contentPadding;
/// Overrides the default value of [ListTile.tileColor]. /// Overrides the default value of [ListTile.tileColor].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.tileColor] property instead. /// [ListTileThemeData.tileColor] property instead.
Color? get tileColor => _data != null ? _data!.tileColor : _tileColor; Color? get tileColor => _data != null ? _data.tileColor : _tileColor;
/// Overrides the default value of [ListTile.selectedTileColor]. /// Overrides the default value of [ListTile.selectedTileColor].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.selectedTileColor] property instead. /// [ListTileThemeData.selectedTileColor] property instead.
Color? get selectedTileColor => _data != null ? _data!.selectedTileColor : _selectedTileColor; Color? get selectedTileColor => _data != null ? _data.selectedTileColor : _selectedTileColor;
/// Overrides the default value of [ListTile.horizontalTitleGap]. /// Overrides the default value of [ListTile.horizontalTitleGap].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.horizontalTitleGap] property instead. /// [ListTileThemeData.horizontalTitleGap] property instead.
double? get horizontalTitleGap => _data != null ? _data!.horizontalTitleGap : _horizontalTitleGap; double? get horizontalTitleGap => _data != null ? _data.horizontalTitleGap : _horizontalTitleGap;
/// Overrides the default value of [ListTile.minVerticalPadding]. /// Overrides the default value of [ListTile.minVerticalPadding].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.minVerticalPadding] property instead. /// [ListTileThemeData.minVerticalPadding] property instead.
double? get minVerticalPadding => _data != null ? _data!.minVerticalPadding : _minVerticalPadding; double? get minVerticalPadding => _data != null ? _data.minVerticalPadding : _minVerticalPadding;
/// Overrides the default value of [ListTile.minLeadingWidth]. /// Overrides the default value of [ListTile.minLeadingWidth].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.minLeadingWidth] property instead. /// [ListTileThemeData.minLeadingWidth] property instead.
double? get minLeadingWidth => _data != null ? _data!.minLeadingWidth : _minLeadingWidth; double? get minLeadingWidth => _data != null ? _data.minLeadingWidth : _minLeadingWidth;
/// Overrides the default value of [ListTile.enableFeedback]. /// Overrides the default value of [ListTile.enableFeedback].
/// ///
/// This property is obsolete: please use the [data] /// This property is obsolete: please use the [data]
/// [ListTileThemeData.enableFeedback] property instead. /// [ListTileThemeData.enableFeedback] property instead.
bool? get enableFeedback => _data != null ? _data!.enableFeedback : _enableFeedback; bool? get enableFeedback => _data != null ? _data.enableFeedback : _enableFeedback;
/// The [data] property of the closest instance of this class that /// The [data] property of the closest instance of this class that
/// encloses the given context. /// encloses the given context.
......
...@@ -405,7 +405,7 @@ class StrutStyle with Diagnosticable { ...@@ -405,7 +405,7 @@ class StrutStyle with Diagnosticable {
/// constructor. /// constructor.
List<String>? get fontFamilyFallback { List<String>? get fontFamilyFallback {
if (_package != null && _fontFamilyFallback != null) { if (_package != null && _fontFamilyFallback != null) {
return _fontFamilyFallback!.map((String family) => 'packages/$_package/$family').toList(); return _fontFamilyFallback.map((String family) => 'packages/$_package/$family').toList();
} }
return _fontFamilyFallback; return _fontFamilyFallback;
} }
......
...@@ -157,11 +157,11 @@ class RenderErrorBox extends RenderBox { ...@@ -157,11 +157,11 @@ class RenderErrorBox extends RenderBox {
width -= padding.left + padding.right; width -= padding.left + padding.right;
left += padding.left; left += padding.left;
} }
_paragraph!.layout(ui.ParagraphConstraints(width: width)); _paragraph.layout(ui.ParagraphConstraints(width: width));
if (size.height > padding.top + _paragraph!.height + padding.bottom) { if (size.height > padding.top + _paragraph.height + padding.bottom) {
top += padding.top; top += padding.top;
} }
context.canvas.drawParagraph(_paragraph!, offset + Offset(left, top)); context.canvas.drawParagraph(_paragraph, offset + Offset(left, top));
} }
} catch (error) { } catch (error) {
// If an error happens here we're in a terrible state, so we really should // If an error happens here we're in a terrible state, so we really should
......
...@@ -1002,7 +1002,7 @@ class EditableText extends StatefulWidget { ...@@ -1002,7 +1002,7 @@ class EditableText extends StatefulWidget {
if (_strutStyle == null) { if (_strutStyle == null) {
return StrutStyle.fromTextStyle(style, forceStrutHeight: true); return StrutStyle.fromTextStyle(style, forceStrutHeight: true);
} }
return _strutStyle!.inheritFromTextStyle(style); return _strutStyle.inheritFromTextStyle(style);
} }
final StrutStyle? _strutStyle; final StrutStyle? _strutStyle;
......
...@@ -5359,7 +5359,7 @@ class ErrorWidget extends LeafRenderObjectWidget { ...@@ -5359,7 +5359,7 @@ class ErrorWidget extends LeafRenderObjectWidget {
if (_flutterError == null) { if (_flutterError == null) {
properties.add(StringProperty('message', message, quoted: false)); properties.add(StringProperty('message', message, quoted: false));
} else { } else {
properties.add(_flutterError!.toDiagnosticsNode(style: DiagnosticsTreeStyle.whitespace)); properties.add(_flutterError.toDiagnosticsNode(style: DiagnosticsTreeStyle.whitespace));
} }
} }
} }
......
...@@ -157,7 +157,7 @@ class IconThemeData with Diagnosticable { ...@@ -157,7 +157,7 @@ class IconThemeData with Diagnosticable {
/// An opacity to apply to both explicit and default icon colors. /// An opacity to apply to both explicit and default icon colors.
/// ///
/// Falls back to 1.0. /// Falls back to 1.0.
double? get opacity => _opacity == null ? null : clampDouble(_opacity!, 0.0, 1.0); double? get opacity => _opacity == null ? null : clampDouble(_opacity, 0.0, 1.0);
final double? _opacity; final double? _opacity;
/// The default for [Icon.shadows]. /// The default for [Icon.shadows].
......
...@@ -65,7 +65,7 @@ class RouteInformation { ...@@ -65,7 +65,7 @@ class RouteInformation {
) )
String get location { String get location {
if (_location != null) { if (_location != null) {
return _location!; return _location;
} }
return Uri.decodeComponent( return Uri.decodeComponent(
Uri( Uri(
...@@ -86,7 +86,7 @@ class RouteInformation { ...@@ -86,7 +86,7 @@ class RouteInformation {
/// In web platform, the host and scheme are always empty. /// In web platform, the host and scheme are always empty.
Uri get uri { Uri get uri {
if (_uri != null){ if (_uri != null){
return _uri!; return _uri;
} }
return Uri.parse(_location!); return Uri.parse(_location!);
} }
......
...@@ -2155,7 +2155,7 @@ class RawDialogRoute<T> extends PopupRoute<T> { ...@@ -2155,7 +2155,7 @@ class RawDialogRoute<T> extends PopupRoute<T> {
child: child, child: child,
); );
} }
return _transitionBuilder!(context, animation, secondaryAnimation, child); return _transitionBuilder(context, animation, secondaryAnimation, child);
} }
} }
......
...@@ -670,22 +670,22 @@ class SliverChildListDelegate extends SliverChildDelegate { ...@@ -670,22 +670,22 @@ class SliverChildListDelegate extends SliverChildDelegate {
} }
// Lazily fill the [_keyToIndex]. // Lazily fill the [_keyToIndex].
if (!_keyToIndex!.containsKey(key)) { if (!_keyToIndex!.containsKey(key)) {
int index = _keyToIndex![null]!; int index = _keyToIndex[null]!;
while (index < children.length) { while (index < children.length) {
final Widget child = children[index]; final Widget child = children[index];
if (child.key != null) { if (child.key != null) {
_keyToIndex![child.key] = index; _keyToIndex[child.key] = index;
} }
if (child.key == key) { if (child.key == key) {
// Record current index for next function call. // Record current index for next function call.
_keyToIndex![null] = index + 1; _keyToIndex[null] = index + 1;
return index; return index;
} }
index += 1; index += 1;
} }
_keyToIndex![null] = index; _keyToIndex[null] = index;
} else { } else {
return _keyToIndex![key]; return _keyToIndex[key];
} }
return null; return null;
} }
......
...@@ -3,7 +3,7 @@ description: A framework for writing Flutter applications ...@@ -3,7 +3,7 @@ description: A framework for writing Flutter applications
homepage: https://flutter.dev homepage: https://flutter.dev
environment: environment:
sdk: '>=3.0.0-0 <4.0.0' sdk: '>=3.2.0-0 <4.0.0'
dependencies: dependencies:
# To update these, use "flutter update-packages --force-upgrade". # To update these, use "flutter update-packages --force-upgrade".
......
...@@ -2078,7 +2078,7 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> { ...@@ -2078,7 +2078,7 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> {
if (_barrierCurve == null) { if (_barrierCurve == null) {
return super.barrierCurve; return super.barrierCurve;
} }
return _barrierCurve!; return _barrierCurve;
} }
final Curve? _barrierCurve; final Curve? _barrierCurve;
......
...@@ -2,7 +2,7 @@ name: flutter_test_private ...@@ -2,7 +2,7 @@ name: flutter_test_private
description: Tests private interfaces of the flutter description: Tests private interfaces of the flutter
environment: environment:
sdk: '>=3.0.0-0 <4.0.0' sdk: '>=3.2.0-0 <4.0.0'
dependencies: dependencies:
# To update these, use "flutter update-packages --force-upgrade". # To update these, use "flutter update-packages --force-upgrade".
......
name: animated_icons_private_test name: animated_icons_private_test
environment: environment:
sdk: '>=3.0.0-0 <4.0.0' sdk: '>=3.2.0-0 <4.0.0'
dependencies: dependencies:
# To update these, use "flutter update-packages --force-upgrade". # To update these, use "flutter update-packages --force-upgrade".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment