Unverified Commit 210f4d83 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Convert Diagnosticable to a mixin (#51495)

This converts Diagnosticable to be a mixin instead of an abstract class, so that it can be used to add diagnostics to classes which already have a base class.

It leaves in place the DiagnosticableMixin mixin, since there are some plugins that are still using it, and removing it would mean that those plugins wouldn't work with master branch Flutter anymore. DiagnosticableMixin will be removed once this mixin version of Diagnosticable makes its way to the stable branch.
parent 6804cef5
......@@ -675,7 +675,7 @@ class CupertinoColors {
/// * [CupertinoTheme.of], a static method that retrieves the ambient [CupertinoThemeData],
/// and then resolves [CupertinoDynamicColor]s used in the retrieved data.
@immutable
class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Diagnosticable {
class CupertinoDynamicColor extends Color with Diagnosticable {
/// Creates an adaptive [Color] that changes its effective color based on the
/// [BuildContext] given. The default effective color is [color].
///
......
......@@ -8,7 +8,7 @@ import 'colors.dart';
/// An [IconThemeData] subclass that automatically resolves its [color] when retrieved
/// using [IconTheme.of].
class CupertinoIconThemeData extends IconThemeData with DiagnosticableMixin implements Diagnosticable {
class CupertinoIconThemeData extends IconThemeData with Diagnosticable {
/// Creates a [CupertinoIconThemeData].
///
/// The opacity applies to both explicit and default icon colors. The value
......
......@@ -107,7 +107,7 @@ TextStyle _resolveTextStyle(TextStyle style, BuildContext context, bool nullOk)
/// Cupertino typography theme in a [CupertinoThemeData].
@immutable
class CupertinoTextThemeData extends Diagnosticable {
class CupertinoTextThemeData with Diagnosticable {
/// Create a [CupertinoTextThemeData].
///
/// The [primaryColor] is used to derive TextStyle defaults of other attributes
......
......@@ -143,7 +143,7 @@ class _InheritedCupertinoTheme extends InheritedWidget {
/// * [ThemeData], a Material equivalent that also configures Cupertino
/// styling via a [CupertinoThemeData] subclass [MaterialBasedCupertinoThemeData].
@immutable
class CupertinoThemeData extends Diagnosticable {
class CupertinoThemeData with Diagnosticable {
/// Creates a [CupertinoTheme] styling specification.
///
/// Unspecified parameters default to a reasonable iOS default style.
......
......@@ -326,7 +326,7 @@ class ErrorSpacer extends DiagnosticsProperty<void> {
/// Class for information provided to [FlutterExceptionHandler] callbacks.
///
/// See [FlutterError.onError].
class FlutterErrorDetails extends Diagnosticable {
class FlutterErrorDetails with Diagnosticable {
/// Creates a [FlutterErrorDetails] object with the given arguments setting
/// the object's properties.
///
......@@ -478,7 +478,7 @@ class FlutterErrorDetails extends Diagnosticable {
return longMessage;
}
DiagnosticableMixin _exceptionToDiagnosticable() {
Diagnosticable _exceptionToDiagnosticable() {
if (exception is FlutterError) {
return exception as FlutterError;
}
......@@ -501,7 +501,7 @@ class FlutterErrorDetails extends Diagnosticable {
if (kReleaseMode) {
return DiagnosticsNode.message(formatException());
}
final DiagnosticableMixin diagnosticable = _exceptionToDiagnosticable();
final Diagnosticable diagnosticable = _exceptionToDiagnosticable();
DiagnosticsNode summary;
if (diagnosticable != null) {
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
......@@ -515,7 +515,7 @@ class FlutterErrorDetails extends Diagnosticable {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
final DiagnosticsNode verb = ErrorDescription('thrown${ context != null ? ErrorDescription(" $context") : ""}');
final DiagnosticableMixin diagnosticable = _exceptionToDiagnosticable();
final Diagnosticable diagnosticable = _exceptionToDiagnosticable();
if (exception is NullThrownError) {
properties.add(ErrorDescription('The null value was $verb.'));
} else if (exception is num) {
......
......@@ -2640,7 +2640,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
Map<String, Object> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final T v = value;
List<Map<String, Object>> properties;
if (delegate.expandPropertyValues && delegate.includeProperties && v is DiagnosticableMixin && getProperties().isEmpty) {
if (delegate.expandPropertyValues && delegate.includeProperties && v is Diagnosticable && getProperties().isEmpty) {
// Exclude children for expanded nodes to avoid cycles.
delegate = delegate.copyWith(subtreeDepth: 0, includeProperties: false);
properties = DiagnosticsNode.toJsonList(
......@@ -2666,7 +2666,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
json['exception'] = exception.toString();
json['propertyType'] = propertyType.toString();
json['defaultLevel'] = describeEnum(_defaultLevel);
if (value is DiagnosticableMixin || value is DiagnosticsNode)
if (value is Diagnosticable || value is DiagnosticsNode)
json['isDiagnosticableValue'] = true;
if (v is num)
// Workaround for https://github.com/flutter/flutter/issues/39937#issuecomment-529558033.
......@@ -2846,7 +2846,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
if (object is DiagnosticsNode) {
return object.getProperties();
}
if (object is DiagnosticableMixin) {
if (object is Diagnosticable) {
return object.toDiagnosticsNode(style: style).getProperties();
}
}
......@@ -2860,7 +2860,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
if (object is DiagnosticsNode) {
return object.getChildren();
}
if (object is DiagnosticableMixin) {
if (object is Diagnosticable) {
return object.toDiagnosticsNode(style: style).getChildren();
}
}
......@@ -2870,7 +2870,7 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
/// [DiagnosticsNode] that lazily calls the associated [Diagnosticable] [value]
/// to implement [getChildren] and [getProperties].
class DiagnosticableNode<T extends DiagnosticableMixin> extends DiagnosticsNode {
class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode {
/// Create a diagnostics describing a [DiagnosticableMixin] value.
///
/// The [value] argument must not be null.
......@@ -3017,42 +3017,47 @@ class DiagnosticPropertiesBuilder {
String emptyBodyDescription;
}
// Examples can assume:
// class ExampleSuperclass extends 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<Listenable, VoidCallback> handles; Color color; bool obscureText; ImageRepeat repeat; Size size; Widget widget; bool isCurrent; bool keepAlive; TextAlign textAlign; }
// TODO(gspencergoog): Remove DiagnosticableMixin once the mixin Diagnosticable is in stable.
// https://github.com/flutter/flutter/issues/50498
/// A base class for providing string and [DiagnosticsNode] debug
/// representations describing the properties of an object.
///
/// The string debug representation is generated from the intermediate
/// [DiagnosticsNode] representation. The [DiagnosticsNode] representation is
/// also used by debugging tools displaying interactive trees of objects and
/// properties.
///
/// See also:
/// A mixin class implementing the [Diagnosticable] interface that provides
/// string and [DiagnosticsNode] debug representations describing the properties
/// of an object.
///
/// * [DiagnosticableTree], which extends this class to also describe the
/// children of a tree structured object.
/// * [DiagnosticableMixin], which provides the implementation for
/// [Diagnosticable], and can be used to add diagnostics to classes which
/// already have a base class.
/// * [DiagnosticableMixin.debugFillProperties], which lists best practices
/// for specifying the properties of a [DiagnosticsNode]. The most common use
/// case is to override [debugFillProperties] defining custom properties for
/// a subclass of [DiagnosticableTreeMixin] using the existing
/// [DiagnosticsProperty] subclasses.
/// * [DiagnosticableTree.debugDescribeChildren], which lists best practices
/// for describing the children of a [DiagnosticsNode]. Typically the base
/// class already describes the children of a node properly or a node has
/// no children.
/// * [DiagnosticsProperty], which should be used to create leaf diagnostic
/// nodes without properties or children. There are many
/// [DiagnosticsProperty] subclasses to handle common use cases.
abstract class Diagnosticable with DiagnosticableMixin {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const Diagnosticable();
/// _This mixin is exists only to support plugins that require older Flutter
/// versions: Use the identical mixin [Diagnosticable] instead for most code._
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<Diagnosticable>(
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<Listenable, VoidCallback> handles; Color color; bool obscureText; ImageRepeat repeat; Size size; Widget widget; bool isCurrent; bool keepAlive; TextAlign textAlign; }
/// A mixin class for providing string and [DiagnosticsNode] debug
/// representations describing the properties of an object.
///
......@@ -3077,7 +3082,7 @@ abstract class Diagnosticable with DiagnosticableMixin {
/// * [DiagnosticsProperty], which should be used to create leaf diagnostic
/// nodes without properties or children. There are many
/// [DiagnosticsProperty] subclasses to handle common use cases.
mixin DiagnosticableMixin {
mixin Diagnosticable {
/// A brief description of this object, usually just the [runtimeType] and the
/// [hashCode].
///
......@@ -3106,7 +3111,7 @@ mixin DiagnosticableMixin {
/// relationship between the parent and the node. For example, pass
/// [DiagnosticsTreeStyle.offstage] to indicate that a node is offstage.
DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) {
return DiagnosticableNode<DiagnosticableMixin>(
return DiagnosticableNode<Diagnosticable>(
name: name,
value: this,
style: style,
......@@ -3338,7 +3343,7 @@ mixin DiagnosticableMixin {
/// * [DiagnosticableTreeMixin], a mixin that implements this class.
/// * [DiagnosticableMixin], which should be used instead of this class to
/// provide diagnostics for objects without children.
abstract class DiagnosticableTree extends Diagnosticable {
abstract class DiagnosticableTree with Diagnosticable {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const DiagnosticableTree();
......
......@@ -196,7 +196,7 @@ bool isSingleButton(int buttons) => buttons != 0 && (smallestButton(buttons) ==
///
/// * [Window.devicePixelRatio], which defines the device's current resolution.
@immutable
abstract class PointerEvent extends Diagnosticable {
abstract class PointerEvent with Diagnosticable {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const PointerEvent({
......
......@@ -30,7 +30,7 @@ typedef PointerHoverEventListener = void Function(PointerHoverEvent event);
/// movements.
///
/// This is added to a layer and managed by the [MouseRegion] widget.
class MouseTrackerAnnotation extends Diagnosticable {
class MouseTrackerAnnotation with Diagnosticable {
/// Creates an annotation that can be used to find layers interested in mouse
/// movements.
const MouseTrackerAnnotation({this.onEnter, this.onHover, this.onExit});
......
......@@ -27,7 +27,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class AppBarTheme extends Diagnosticable {
class AppBarTheme with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.AppBarTheme].
const AppBarTheme({
this.brightness,
......
......@@ -23,7 +23,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class MaterialBannerThemeData extends Diagnosticable {
class MaterialBannerThemeData with Diagnosticable {
/// Creates a theme that can be used for [MaterialBannerTheme] or
/// [ThemeData.bannerTheme].
......
......@@ -25,7 +25,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class BottomAppBarTheme extends Diagnosticable {
class BottomAppBarTheme with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.BottomAppBarTheme].
const BottomAppBarTheme({
this.color,
......
......@@ -24,7 +24,7 @@ import 'package:flutter/rendering.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class BottomSheetThemeData extends Diagnosticable {
class BottomSheetThemeData with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.bottomSheetTheme].
const BottomSheetThemeData({
this.backgroundColor,
......
......@@ -24,7 +24,7 @@ import 'theme.dart';
/// its subtree.
/// * [ButtonBar], which uses this to configure itself and its children
/// button widgets.
class ButtonBarThemeData extends Diagnosticable {
class ButtonBarThemeData with Diagnosticable {
/// Constructs the set of properties used to configure [ButtonBar] widgets.
///
/// Both [buttonMinWidth] and [buttonHeight] must be non-negative if they
......
......@@ -248,7 +248,7 @@ class ButtonTheme extends InheritedTheme {
/// A button theme can be specified as part of the overall Material theme
/// using [ThemeData.buttonTheme]. The Material theme's button theme data
/// can be overridden with [ButtonTheme].
class ButtonThemeData extends Diagnosticable {
class ButtonThemeData with Diagnosticable {
/// Create a button theme object that can be used with [ButtonTheme]
/// or [ThemeData].
///
......
......@@ -26,7 +26,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class CardTheme extends Diagnosticable {
class CardTheme with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.cardTheme].
///
......
......@@ -168,7 +168,7 @@ class ChipTheme extends InheritedTheme {
/// * [Theme] widget, which performs a similar function to [ChipTheme],
/// but for overall themes.
/// * [ThemeData], which has a default [ChipThemeData].
class ChipThemeData extends Diagnosticable {
class ChipThemeData with Diagnosticable {
/// Create a [ChipThemeData] given a set of exact values. All the values
/// must be specified except for [shadowColor], [selectedShadowColor],
/// [elevation], and [pressElevation], which may be null.
......
......@@ -16,7 +16,7 @@ import 'theme_data.dart';
/// The [Theme] has a color scheme, [ThemeData.colorScheme], which is constructed
/// with [ColorScheme.fromSwatch].
@immutable
class ColorScheme extends Diagnosticable {
class ColorScheme with Diagnosticable {
/// Create a ColorScheme instance.
const ColorScheme({
@required this.primary,
......
......@@ -27,7 +27,7 @@ import 'theme.dart';
/// * [Dialog], a material dialog that can be customized using this [DialogTheme].
/// * [ThemeData], which describes the overall theme information for the
/// application.
class DialogTheme extends Diagnosticable {
class DialogTheme with Diagnosticable {
/// Creates a dialog theme that can be used for [ThemeData.dialogTheme].
const DialogTheme({
this.backgroundColor,
......
......@@ -26,7 +26,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class DividerThemeData extends Diagnosticable {
class DividerThemeData with Diagnosticable {
/// Creates a theme that can be used for [DividerTheme] or
/// [ThemeData.dividerTheme].
......
......@@ -26,7 +26,7 @@ import 'package:flutter/rendering.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class FloatingActionButtonThemeData extends Diagnosticable {
class FloatingActionButtonThemeData with Diagnosticable {
/// Creates a theme that can be used for
/// [ThemeData.floatingActionButtonTheme].
const FloatingActionButtonThemeData({
......
......@@ -3548,7 +3548,7 @@ class InputDecoration {
/// The [InputDecoration.applyDefaults] method is used to combine a input
/// decoration theme with an [InputDecoration] object.
@immutable
class InputDecorationTheme extends Diagnosticable {
class InputDecorationTheme with Diagnosticable {
/// Creates a value for [ThemeData.inputDecorationTheme] that
/// defines default values for [InputDecorator].
///
......
......@@ -483,7 +483,7 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
@immutable
class PageTransitionsTheme extends Diagnosticable {
class PageTransitionsTheme with Diagnosticable {
/// Construct a PageTransitionsTheme.
///
/// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder]
......
......@@ -29,7 +29,7 @@ import 'theme.dart';
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class PopupMenuThemeData extends Diagnosticable {
class PopupMenuThemeData with Diagnosticable {
/// Creates the set of properties used to configure [PopupMenuTheme].
const PopupMenuThemeData({
this.color,
......
......@@ -305,7 +305,7 @@ enum Thumb {
/// {@macro flutter.material.slider.seeAlso.rangeSliderValueIndicatorShape}
/// {@macro flutter.material.slider.seeAlso.rangeSliderTrackShape}
/// {@macro flutter.material.slider.seeAlso.rangeSliderTickMarkShape}
class SliderThemeData extends Diagnosticable {
class SliderThemeData with Diagnosticable {
/// Create a [SliderThemeData] given a set of exact values. All the values
/// must be specified.
///
......
......@@ -46,7 +46,7 @@ enum SnackBarBehavior {
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
class SnackBarThemeData extends Diagnosticable {
class SnackBarThemeData with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.snackBarTheme].
///
......
......@@ -23,7 +23,7 @@ import 'theme.dart';
/// * [TabBar], a widget that displays a horizontal row of tabs.
/// * [ThemeData], which describes the overall theme information for the
/// application.
class TabBarTheme extends Diagnosticable {
class TabBarTheme with Diagnosticable {
/// Creates a tab bar theme that can be used with [ThemeData.tabBarTheme].
const TabBarTheme({
this.indicator,
......
......@@ -103,7 +103,7 @@ import 'typography.dart';
/// globally adjusted, such as the color scheme.
/// * <https://material.io/design/typography/>
@immutable
class TextTheme extends Diagnosticable {
class TextTheme with Diagnosticable {
/// Creates a text theme that uses the given values.
///
/// Rather than creating a new text theme, consider using [Typography.black]
......
......@@ -163,7 +163,7 @@ enum MaterialTapTargetSize {
/// ```
/// {@end-tool}
@immutable
class ThemeData extends Diagnosticable {
class ThemeData with Diagnosticable {
/// Create a [ThemeData] given a set of preferred values.
///
/// Default values will be derived for arguments that are omitted.
......@@ -1697,7 +1697,7 @@ class _FifoCache<K, V> {
/// * [ThemeData.visualDensity], where this property is used to specify the base
/// horizontal density of Material components.
/// * [Material design guidance on density](https://material.io/design/layout/applying-density.html).
class VisualDensity extends Diagnosticable {
class VisualDensity with Diagnosticable {
/// A const constructor for [VisualDensity].
///
/// All of the arguments must be non-null, and [horizontal] and [vertical]
......
......@@ -24,7 +24,7 @@ import 'theme.dart';
///
/// * [ToggleButtonsTheme], which describes the actual configuration of a
/// toggle buttons theme.
class ToggleButtonsThemeData extends Diagnosticable {
class ToggleButtonsThemeData with Diagnosticable {
/// Creates the set of color and border properties used to configure
/// [ToggleButtons].
const ToggleButtonsThemeData({
......
......@@ -23,7 +23,7 @@ import 'theme.dart';
/// subtree.
/// * [TooltipThemeData], which describes the actual configuration of a
/// tooltip theme.
class TooltipThemeData extends Diagnosticable {
class TooltipThemeData with Diagnosticable {
/// Creates the set of properties used to configure [Tooltip]s.
const TooltipThemeData({
this.height,
......
......@@ -82,7 +82,7 @@ enum ScriptCategory {
/// [ThemeData.primaryTextTheme], [ThemeData.accentTextTheme].
/// * <https://material.io/design/typography/>
@immutable
class Typography extends Diagnosticable {
class Typography with Diagnosticable {
/// Creates a typography instance.
///
/// This constructor is identical to [Typography.material2014]. It is
......
......@@ -20,7 +20,7 @@ import 'image_provider.dart';
/// shared between boxes; [BoxPainter] objects can cache resources to
/// make painting on a particular surface faster.
@immutable
abstract class Decoration extends Diagnosticable {
abstract class Decoration with Diagnosticable {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const Decoration();
......
......@@ -159,7 +159,7 @@ typedef ImageErrorListener = void Function(dynamic exception, StackTrace stackTr
/// * [ImageChunkListener], the means by which callers get notified of
/// these events.
@immutable
class ImageChunkEvent extends Diagnosticable {
class ImageChunkEvent with Diagnosticable {
/// Creates a new chunk event.
const ImageChunkEvent({
@required this.cumulativeBytesLoaded,
......@@ -212,7 +212,7 @@ class ImageChunkEvent extends Diagnosticable {
///
/// * [ImageProvider], which has an example that includes the use of an
/// [ImageStream] in a [Widget].
class ImageStream extends Diagnosticable {
class ImageStream with Diagnosticable {
/// Create an initially unbound image stream.
///
/// Once an [ImageStreamCompleter] is available, call [setCompleter].
......@@ -324,7 +324,7 @@ class ImageStream extends Diagnosticable {
/// [ImageStreamListener] objects are rarely constructed directly. Generally, an
/// [ImageProvider] subclass will return an [ImageStream] and automatically
/// configure it with the right [ImageStreamCompleter] when possible.
abstract class ImageStreamCompleter extends Diagnosticable {
abstract class ImageStreamCompleter with Diagnosticable {
final List<ImageStreamListener> _listeners = <ImageStreamListener>[];
ImageInfo _currentImage;
FlutterErrorDetails _currentError;
......
......@@ -285,7 +285,7 @@ import 'text_style.dart';
/// {@end-tool}
///
@immutable
class StrutStyle extends Diagnosticable {
class StrutStyle with Diagnosticable {
/// Creates a strut style.
///
/// The `package` argument must be non-null if the font family is defined in a
......
......@@ -391,7 +391,7 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a
/// * [TextStyle](https://api.flutter.dev/flutter/dart-ui/TextStyle-class.html), the class in the [dart:ui] library.
///
@immutable
class TextStyle extends Diagnosticable {
class TextStyle with Diagnosticable {
/// Creates a text style.
///
/// The `package` argument must be non-null if the font family is defined in a
......
......@@ -525,7 +525,7 @@ class SliverConstraints extends Constraints {
/// A sliver can occupy space in several different ways, which is why this class
/// contains multiple values.
@immutable
class SliverGeometry extends Diagnosticable {
class SliverGeometry with Diagnosticable {
/// Creates an object that describes the amount of space occupied by a sliver.
///
/// If the [layoutExtent] argument is null, [layoutExtent] defaults to the
......
......@@ -172,7 +172,7 @@ class CustomSemanticsAction {
///
/// Typically obtained from [SemanticsNode.getSemanticsData].
@immutable
class SemanticsData extends Diagnosticable {
class SemanticsData with Diagnosticable {
/// Creates a semantics data object.
///
/// The [flags], [actions], [label], and [Rect] arguments must not be null.
......@@ -3997,7 +3997,7 @@ String _concatStrings({
/// See also:
///
/// * [OrdinalSortKey] for a sort key that sorts using an ordinal.
abstract class SemanticsSortKey extends Diagnosticable implements Comparable<SemanticsSortKey> {
abstract class SemanticsSortKey with Diagnosticable implements Comparable<SemanticsSortKey> {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const SemanticsSortKey({this.name});
......
......@@ -19,7 +19,7 @@ import 'package:flutter/foundation.dart';
/// that are returned from [RawKeyEvent.physicalKey].
/// * [LogicalKeyboardKey], a class with static values that describe the keys
/// that are returned from [RawKeyEvent.logicalKey].
abstract class KeyboardKey extends Diagnosticable {
abstract class KeyboardKey with Diagnosticable {
/// A const constructor so that subclasses may be const.
const KeyboardKey();
}
......
......@@ -236,7 +236,7 @@ abstract class RawKeyEventData {
/// * [RawKeyboard], which uses this interface to expose key data.
/// * [RawKeyboardListener], a widget that listens for raw key events.
@immutable
abstract class RawKeyEvent extends Diagnosticable {
abstract class RawKeyEvent with Diagnosticable {
/// Initializes fields for subclasses, and provides a const constructor for
/// const subclasses.
const RawKeyEvent({
......
......@@ -25,7 +25,7 @@ typedef ActionFactory = Action Function();
///
/// If this intent returns false from [isEnabled], then its associated action will
/// not be invoked if requested.
class Intent extends Diagnosticable {
class Intent with Diagnosticable {
/// A const constructor for an [Intent].
///
/// The [key] argument must not be null.
......@@ -73,7 +73,7 @@ class Intent extends Diagnosticable {
/// and allows redefining of actions for its descendants.
/// * [ActionDispatcher], a class that takes an [Action] and invokes it using a
/// [FocusNode] for context.
abstract class Action extends Diagnosticable {
abstract class Action with Diagnosticable {
/// A const constructor for an [Action].
///
/// The [intentKey] parameter must not be null.
......@@ -140,7 +140,7 @@ class CallbackAction extends Action {
}
/// An action manager that simply invokes the actions given to it.
class ActionDispatcher extends Diagnosticable {
class ActionDispatcher with Diagnosticable {
/// Const constructor so that subclasses can be const.
const ActionDispatcher();
......
......@@ -1352,7 +1352,7 @@ enum FocusHighlightStrategy {
/// subtrees into groups and restrict focus to them.
/// * The [primaryFocus] global accessor, for convenient access from anywhere
/// to the current focus manager state.
class FocusManager with DiagnosticableTreeMixin, ChangeNotifier implements Diagnosticable {
class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
/// Creates an object that manages the focus tree.
///
/// This constructor is rarely called directly. To access the [FocusManager],
......
......@@ -115,7 +115,7 @@ enum TraversalDirection {
/// * [DirectionalFocusTraversalPolicyMixin] a mixin class that implements
/// focus traversal in a direction.
@immutable
abstract class FocusTraversalPolicy extends Diagnosticable {
abstract class FocusTraversalPolicy with Diagnosticable {
/// A const constructor so subclasses can be const.
const FocusTraversalPolicy();
......@@ -806,7 +806,7 @@ class WidgetOrderTraversalPolicy extends FocusTraversalPolicy with DirectionalFo
//
// It's also a convenient place to put some utility functions having to do with
// the sort data.
class _ReadingOrderSortData extends Diagnosticable {
class _ReadingOrderSortData with Diagnosticable {
_ReadingOrderSortData(this.node)
: assert(node != null),
rect = node.rect,
......@@ -886,7 +886,7 @@ class _ReadingOrderSortData extends Diagnosticable {
// A class for containing group data while sorting in reading order while taking
// into account the ambient directionality.
class _ReadingOrderDirectionalGroupData extends Diagnosticable {
class _ReadingOrderDirectionalGroupData with Diagnosticable {
_ReadingOrderDirectionalGroupData(this.members);
final List<_ReadingOrderSortData> members;
......@@ -1105,7 +1105,7 @@ class ReadingOrderTraversalPolicy extends FocusTraversalPolicy with DirectionalF
/// * [LexicalFocusOrder], a focus order that assigns a string-based lexical
/// traversal order to a [FocusTraversalOrder] widget.
@immutable
abstract class FocusOrder extends Diagnosticable implements Comparable<FocusOrder> {
abstract class FocusOrder with Diagnosticable implements Comparable<FocusOrder> {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const FocusOrder();
......
......@@ -1026,7 +1026,7 @@ typedef StateSetter = void Function(VoidCallback fn);
/// be read by descendant widgets.
/// * [Widget], for an overview of widgets in general.
@optionalTypeArgs
abstract class State<T extends StatefulWidget> extends Diagnosticable {
abstract class State<T extends StatefulWidget> with Diagnosticable {
/// The current configuration.
///
/// A [State] object's configuration is the corresponding [StatefulWidget]
......
......@@ -18,7 +18,7 @@ import 'framework.dart' show BuildContext;
/// To obtain the current icon theme, use [IconTheme.of]. To convert an icon
/// theme to a version with all the fields filled in, use [new
/// IconThemeData.fallback].
class IconThemeData extends Diagnosticable {
class IconThemeData with Diagnosticable {
/// Creates an icon theme data.
///
/// The opacity applies to both explicit and default icon colors. The value
......
......@@ -110,7 +110,7 @@ class KeySet<T extends KeyboardKey> {
/// This is a thin wrapper around a [Set], but changes the equality comparison
/// from an identity comparison to a contents comparison so that non-identical
/// sets with the same keys in them will compare as equal.
class LogicalKeySet extends KeySet<LogicalKeyboardKey> with DiagnosticableMixin implements Diagnosticable {
class LogicalKeySet extends KeySet<LogicalKeyboardKey> with Diagnosticable {
/// A constructor for making a [LogicalKeySet] of up to four keys.
///
/// If you need a set of more than four keys, use [LogicalKeySet.fromSet].
......@@ -201,7 +201,7 @@ class ShortcutMapProperty extends DiagnosticsProperty<Map<LogicalKeySet, Intent>
///
/// A [ShortcutManager] is obtained by calling [Shortcuts.of] on the context of
/// the widget that you want to find a manager for.
class ShortcutManager extends ChangeNotifier with DiagnosticableMixin implements Diagnosticable {
class ShortcutManager extends ChangeNotifier with Diagnosticable {
/// Constructs a [ShortcutManager].
///
/// The [shortcuts] argument must not be null.
......
......@@ -635,7 +635,7 @@ class _DiagnosticsPathNode {
}
List<_DiagnosticsPathNode> _followDiagnosticableChain(
List<DiagnosticableMixin> chain, {
List<Diagnosticable> chain, {
String name,
DiagnosticsTreeStyle style,
}) {
......@@ -644,7 +644,7 @@ List<_DiagnosticsPathNode> _followDiagnosticableChain(
return path;
DiagnosticsNode diagnostic = chain.first.toDiagnosticsNode(name: name, style: style);
for (int i = 1; i < chain.length; i += 1) {
final DiagnosticableMixin target = chain[i];
final Diagnosticable target = chain[i];
bool foundMatch = false;
final List<DiagnosticsNode> children = diagnostic.getChildren();
for (int j = 0; j < children.length; j += 1) {
......@@ -1550,7 +1550,7 @@ mixin WidgetInspectorService {
return true;
}
final Object value = node.value;
if (value is! DiagnosticableMixin) {
if (value is! Diagnosticable) {
return true;
}
if (value is! Element || !isWidgetCreationTracked()) {
......
......@@ -180,7 +180,7 @@ void validatePropertyJsonSerializationHelper(final Map<String, Object> json, Dia
}
expect(json['propertyType'], equals(property.propertyType.toString()));
expect(json.containsKey('defaultLevel'), isTrue);
if (property.value is DiagnosticableMixin) {
if (property.value is Diagnosticable) {
expect(json['isDiagnosticableValue'], isTrue);
} else {
expect(json.containsKey('isDiagnosticableValue'), isFalse);
......
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