Unify the format of all objects' inclusion of hashCode in toString() (#8192)
This commit is contained in:
parent
e43b40ffd7
commit
0d81bdf54d
@ -405,5 +405,5 @@ abstract class InkFeature {
|
|||||||
void paintFeature(Canvas canvas, Matrix4 transform);
|
void paintFeature(Canvas canvas, Matrix4 transform);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode';
|
String toString() => '$runtimeType#$hashCode';
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ class BoxHitTestEntry extends HitTestEntry {
|
|||||||
final Point localPosition;
|
final Point localPosition;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '${target.runtimeType}@$localPosition';
|
String toString() => '${target.runtimeType}#${target.hashCode}@$localPosition';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parent data used by [RenderBox] and its subclasses.
|
/// Parent data used by [RenderBox] and its subclasses.
|
||||||
|
@ -620,7 +620,7 @@ abstract class _SemanticsFragment {
|
|||||||
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics });
|
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics });
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType($hashCode)';
|
String toString() => '$runtimeType#$hashCode';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a subtree that doesn't need updating, it already has a
|
/// Represents a subtree that doesn't need updating, it already has a
|
||||||
@ -2396,7 +2396,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
/// Returns a human understandable name.
|
/// Returns a human understandable name.
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
String header = '$runtimeType';
|
String header = '$runtimeType#$hashCode';
|
||||||
if (_relayoutBoundary != null && _relayoutBoundary != this) {
|
if (_relayoutBoundary != null && _relayoutBoundary != this) {
|
||||||
int count = 1;
|
int count = 1;
|
||||||
RenderObject target = parent;
|
RenderObject target = parent;
|
||||||
|
@ -760,5 +760,5 @@ class SemanticsOwner extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode';
|
String toString() => '$runtimeType#$hashCode';
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ abstract class AssetBundle {
|
|||||||
void evict(String key) { }
|
void evict(String key) { }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode()';
|
String toString() => '$runtimeType#$hashCode()';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An [AssetBundle] that loads resources over the network.
|
/// An [AssetBundle] that loads resources over the network.
|
||||||
@ -120,7 +120,7 @@ class NetworkAssetBundle extends AssetBundle {
|
|||||||
// should implement evict().
|
// should implement evict().
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode($_baseUrl)';
|
String toString() => '$runtimeType#$hashCode($_baseUrl)';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An [AssetBundle] that permanently caches string and structured resources
|
/// An [AssetBundle] that permanently caches string and structured resources
|
||||||
|
@ -95,7 +95,7 @@ class UniqueKey extends LocalKey {
|
|||||||
UniqueKey();
|
UniqueKey();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '[$hashCode]';
|
String toString() => '[#$hashCode]';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A key that takes its identity from the object used as its value.
|
/// A key that takes its identity from the object used as its value.
|
||||||
@ -123,8 +123,8 @@ class ObjectKey extends LocalKey {
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
if (runtimeType == ObjectKey)
|
if (runtimeType == ObjectKey)
|
||||||
return '[${value.runtimeType}@${value.hashCode}]';
|
return '[${value.runtimeType}#${value.hashCode}]';
|
||||||
return '[$runtimeType ${value.runtimeType}@${value.hashCode}]';
|
return '[$runtimeType ${value.runtimeType}#${value.hashCode}]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,9 +309,10 @@ class LabeledGlobalKey<T extends State<StatefulWidget>> extends GlobalKey<T> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
String tag = _debugLabel != null ? ' $_debugLabel' : '#$hashCode';
|
||||||
if (this.runtimeType == LabeledGlobalKey)
|
if (this.runtimeType == LabeledGlobalKey)
|
||||||
return '[GlobalKey ${_debugLabel ?? hashCode}]';
|
return '[GlobalKey$tag]';
|
||||||
return '[$runtimeType ${_debugLabel ?? hashCode}]';
|
return '[$runtimeType$tag]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ class GlobalObjectKey<T extends State<StatefulWidget>> extends GlobalKey<T> {
|
|||||||
int get hashCode => identityHashCode(value);
|
int get hashCode => identityHashCode(value);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '[$runtimeType ${value.runtimeType}@${value.hashCode}]';
|
String toString() => '[$runtimeType ${value.runtimeType}#${value.hashCode}]';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This class is a work-around for the "is" operator not accepting a variable value as its right operand
|
/// This class is a work-around for the "is" operator not accepting a variable value as its right operand
|
||||||
@ -1040,7 +1041,7 @@ abstract class State<T extends StatefulWidget> {
|
|||||||
String toString() {
|
String toString() {
|
||||||
final List<String> data = <String>[];
|
final List<String> data = <String>[];
|
||||||
debugFillDescription(data);
|
debugFillDescription(data);
|
||||||
return '$runtimeType(${data.join("; ")})';
|
return '$runtimeType#$hashCode(${data.join("; ")})';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add additional information to the given description for use by [toString].
|
/// Add additional information to the given description for use by [toString].
|
||||||
@ -1055,7 +1056,6 @@ abstract class State<T extends StatefulWidget> {
|
|||||||
@protected
|
@protected
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void debugFillDescription(List<String> description) {
|
void debugFillDescription(List<String> description) {
|
||||||
description.add('$hashCode');
|
|
||||||
assert(() {
|
assert(() {
|
||||||
if (_debugLifecycleState != _StateLifecycle.ready)
|
if (_debugLifecycleState != _StateLifecycle.ready)
|
||||||
description.add('$_debugLifecycleState');
|
description.add('$_debugLifecycleState');
|
||||||
|
@ -150,7 +150,7 @@ class OverlayEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode(opaque: $opaque; maintainState: $maintainState)';
|
String toString() => '$runtimeType#$hashCode(opaque: $opaque; maintainState: $maintainState)';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OverlayEntry extends StatefulWidget {
|
class _OverlayEntry extends StatefulWidget {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io' show Platform;
|
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
@ -124,13 +123,15 @@ void main() {
|
|||||||
|
|
||||||
result = await binding.testExtension('debugDumpRenderTree', <String, String>{});
|
result = await binding.testExtension('debugDumpRenderTree', <String, String>{});
|
||||||
expect(result, <String, String>{});
|
expect(result, <String, String>{});
|
||||||
expect(console, <String>[
|
expect(console, <Matcher>[
|
||||||
'RenderView\n'
|
matches(
|
||||||
' debug mode enabled - ${Platform.operatingSystem}\n'
|
r'RenderView#[0-9]+\n'
|
||||||
' window size: Size(800.0, 600.0) (in physical pixels)\n'
|
r' debug mode enabled - [a-zA-Z]+\n'
|
||||||
' device pixel ratio: 1.0 (physical pixels per logical pixel)\n'
|
r' window size: Size\(800\.0, 600\.0\) \(in physical pixels\)\n'
|
||||||
' configuration: Size(800.0, 600.0) at 1.0x (in logical pixels)\n'
|
r' device pixel ratio: 1\.0 \(physical pixels per logical pixel\)\n'
|
||||||
'\n'
|
r' configuration: Size\(800\.0, 600\.0\) at 1\.0x \(in logical pixels\)\n'
|
||||||
|
r'\n'
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
console.clear();
|
console.clear();
|
||||||
});
|
});
|
||||||
|
@ -75,7 +75,7 @@ class BackgroundImageProvider extends ImageProvider<BackgroundImageProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType($hashCode)';
|
String toString() => '$runtimeType#$hashCode()';
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestImage extends ui.Image {
|
class TestImage extends ui.Image {
|
||||||
|
@ -78,7 +78,7 @@ class TestAssetBundle extends CachingAssetBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType@$hashCode()';
|
String toString() => '$runtimeType#$hashCode()';
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestAssetImage extends AssetImage {
|
class TestAssetImage extends AssetImage {
|
||||||
|
@ -291,12 +291,12 @@ void main() {
|
|||||||
TestImageProvider imageProvider = new TestImageProvider();
|
TestImageProvider imageProvider = new TestImageProvider();
|
||||||
await tester.pumpWidget(new Image(image: imageProvider));
|
await tester.pumpWidget(new Image(image: imageProvider));
|
||||||
State<Image> image = tester.state/*State<Image>*/(find.byType(Image));
|
State<Image> image = tester.state/*State<Image>*/(find.byType(Image));
|
||||||
expect(image.toString(), matches(new RegExp(r'_ImageState\([0-9]+; stream: ImageStream\(OneFrameImageStreamCompleter; unresolved; 1 listener\); pixels: null\)')));
|
expect(image.toString(), matches(new RegExp(r'_ImageState#[0-9]+\(stream: ImageStream\(OneFrameImageStreamCompleter; unresolved; 1 listener\); pixels: null\)')));
|
||||||
imageProvider.complete();
|
imageProvider.complete();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(image.toString(), matches(new RegExp(r'_ImageState\([0-9]+; stream: ImageStream\(OneFrameImageStreamCompleter; \[100×100\] @ 1\.0x; 1 listener\); pixels: \[100×100\] @ 1\.0x\)')));
|
expect(image.toString(), matches(new RegExp(r'_ImageState#[0-9]+\(stream: ImageStream\(OneFrameImageStreamCompleter; \[100×100\] @ 1\.0x; 1 listener\); pixels: \[100×100\] @ 1\.0x\)')));
|
||||||
await tester.pumpWidget(new Container());
|
await tester.pumpWidget(new Container());
|
||||||
expect(image.toString(), matches(new RegExp(r'_ImageState\([0-9]+; _StateLifecycle.defunct; not mounted; stream: ImageStream\(OneFrameImageStreamCompleter; \[100×100\] @ 1\.0x; 0 listeners\); pixels: \[100×100\] @ 1\.0x\)')));
|
expect(image.toString(), matches(new RegExp(r'_ImageState#[0-9]+\(_StateLifecycle.defunct; not mounted; stream: ImageStream\(OneFrameImageStreamCompleter; \[100×100\] @ 1\.0x; 0 listeners\); pixels: \[100×100\] @ 1\.0x\)')));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ class TestImageProvider extends ImageProvider<TestImageProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$runtimeType($hashCode)';
|
String toString() => '$runtimeType#$hashCode()';
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestImage extends ui.Image {
|
class TestImage extends ui.Image {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user