From 2163731c995a2476a3fbac3bb6c487c97636dbd3 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Tue, 16 Jun 2020 09:25:04 -0700 Subject: [PATCH] Remove DiagnosticableMixin in favor of Diagnosticable (#58635) --- dev/manual_tests/lib/actions.dart | 2 +- .../lib/src/foundation/diagnostics.dart | 50 ++----------------- .../flutter/lib/src/scheduler/ticker.dart | 2 +- 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/dev/manual_tests/lib/actions.dart b/dev/manual_tests/lib/actions.dart index 847cf23e20..000198319a 100644 --- a/dev/manual_tests/lib/actions.dart +++ b/dev/manual_tests/lib/actions.dart @@ -22,7 +22,7 @@ void main() { /// /// Instances of this class are returned from [UndoableAction]s and placed on /// the undo stack when they are invoked. -class Memento extends Object with DiagnosticableMixin implements Diagnosticable { +class Memento extends Object with Diagnosticable { const Memento({ @required this.name, @required this.undo, diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index a8c753b7e7..547c1d3907 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -2913,7 +2913,7 @@ class DiagnosticsProperty extends DiagnosticsNode { /// [DiagnosticsNode] that lazily calls the associated [Diagnosticable] [value] /// to implement [getChildren] and [getProperties]. class DiagnosticableNode extends DiagnosticsNode { - /// Create a diagnostics describing a [DiagnosticableMixin] value. + /// Create a diagnostics describing a [Diagnosticable] value. /// /// The [value] argument must not be null. DiagnosticableNode({ @@ -3040,7 +3040,7 @@ String describeEnum(Object enumEntry) { } /// Builder to accumulate properties and configuration used to assemble a -/// [DiagnosticsNode] from a [DiagnosticableMixin] object. +/// [DiagnosticsNode] from a [Diagnosticable] object. class DiagnosticPropertiesBuilder { /// Creates a [DiagnosticPropertiesBuilder] with [properties] initialize to /// an empty array. @@ -3067,48 +3067,6 @@ class DiagnosticPropertiesBuilder { String emptyBodyDescription; } -// TODO(gspencergoog): Remove DiagnosticableMixin once the mixin Diagnosticable is in stable. -// https://github.com/flutter/flutter/issues/50498 - -/// A mixin class implementing the [Diagnosticable] interface that provides -/// string and [DiagnosticsNode] debug representations describing the properties -/// of an object. -/// -/// _This mixin exists only to support plugins and packages that require older -/// Flutter versions: Use the identical mixin [Diagnosticable] instead for all -/// new code. If you are authoring code that needs to work on the stable branch -/// as well as master (in a package, for instance), mix this in instead of -/// extending [Diagnosticable]. Once [Diagnosticable] as a mixin reaches the -/// stable channel, this class will be deprecated._ -mixin DiagnosticableMixin implements Diagnosticable { - @override - String toStringShort() => describeIdentity(this); - - @override - String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { - String fullString; - assert(() { - fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); - return true; - }()); - return fullString ?? toStringShort(); - } - - @override - DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) { - return DiagnosticableNode( - name: name, - value: this, - style: style, - ); - } - - @override - @protected - @mustCallSuper - void debugFillProperties(DiagnosticPropertiesBuilder properties) { } -} - // Examples can assume: // class ExampleSuperclass with Diagnosticable { String message; double stepWidth; double scale; double paintExtent; double hitTestExtent; double paintExtend; double maxWidth; bool primary; double progress; int maxLines; Duration duration; int depth; dynamic boxShadow; dynamic style; bool hasSize; Matrix4 transform; Map handles; Color color; bool obscureText; ImageRepeat repeat; Size size; Widget widget; bool isCurrent; bool keepAlive; TextAlign textAlign; } @@ -3395,7 +3353,7 @@ mixin Diagnosticable { /// See also: /// /// * [DiagnosticableTreeMixin], a mixin that implements this class. -/// * [DiagnosticableMixin], which should be used instead of this class to +/// * [Diagnosticable], which should be used instead of this class to /// provide diagnostics for objects without children. abstract class DiagnosticableTree with Diagnosticable { /// Abstract const constructor. This constructor enables subclasses to provide @@ -3712,7 +3670,7 @@ abstract class DiagnosticsSerializationDelegate { /// will be included. bool get includeProperties; - /// Whether properties that have a [DiagnosticableMixin] as value should be + /// Whether properties that have a [Diagnosticable] as value should be /// expanded. bool get expandPropertyValues; diff --git a/packages/flutter/lib/src/scheduler/ticker.dart b/packages/flutter/lib/src/scheduler/ticker.dart index c686d4ffcf..0c02f4f8b3 100644 --- a/packages/flutter/lib/src/scheduler/ticker.dart +++ b/packages/flutter/lib/src/scheduler/ticker.dart @@ -41,7 +41,7 @@ abstract class TickerProvider { Ticker createTicker(TickerCallback onTick); } -// TODO(jacobr): make Ticker use DiagnosticableMixin to simplify reporting errors +// TODO(jacobr): make Ticker use Diagnosticable to simplify reporting errors // related to a ticker. /// Calls its callback once per animation frame. ///