Skip to content

Commit e1cce0b

Browse files
authored
Shorten method signature to make invokations fit one line. (#163822)
Contributes to flutter/flutter#137435.
1 parent a4a5a33 commit e1cce0b

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

packages/flutter/lib/src/animation/animations.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,7 @@ class ReverseAnimation extends Animation<double>
379379
class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<double> {
380380
/// Creates a curved animation.
381381
CurvedAnimation({required this.parent, required this.curve, this.reverseCurve}) {
382-
assert(
383-
debugMaybeDispatchObjectCreated('package:flutter/animation.dart', 'CurvedAnimation', this),
384-
);
382+
assert(debugMaybeDispatchCreated('animation', 'CurvedAnimation', this));
385383
_updateCurveDirection(parent.status);
386384
parent.addStatusListener(_updateCurveDirection);
387385
}
@@ -428,7 +426,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
428426

429427
/// Cleans up any listeners added by this CurvedAnimation.
430428
void dispose() {
431-
assert(debugMaybeDispatchObjectDisposed(this));
429+
assert(debugMaybeDispatchDisposed(this));
432430
isDisposed = true;
433431
parent.removeStatusListener(_updateCurveDirection);
434432
}

packages/flutter/lib/src/foundation/debug.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,22 @@ String? activeDevToolsServerAddress;
134134
/// The uri for the connected vm service protocol.
135135
String? connectedVmServiceUri;
136136

137-
/// If memory allocation tracking is enabled, dispatch object creation.
137+
/// If memory allocation tracking is enabled, dispatch Flutter object creation.
138138
///
139139
/// This method is not member of FlutterMemoryAllocations, because
140140
/// [FlutterMemoryAllocations] should not increase size of the Flutter application
141141
/// if memory allocations are disabled.
142142
///
143-
/// Should be called only from within an assert.
143+
/// The [flutterLibrary] argument is the name of the Flutter library where
144+
/// the object is declared. For example, 'widgets' for widgets.dart.
145+
///
146+
/// Should be called only from within an assert and only inside Flutter Framework.
144147
///
145148
/// Returns true to make it easier to be wrapped into `assert`.
146-
bool debugMaybeDispatchObjectCreated(String library, String className, Object object) {
149+
bool debugMaybeDispatchCreated(String flutterLibrary, String className, Object object) {
147150
if (kFlutterMemoryAllocationsEnabled) {
148151
FlutterMemoryAllocations.instance.dispatchObjectCreated(
149-
library: library,
152+
library: 'package:flutter/$flutterLibrary.dart',
150153
className: className,
151154
object: object,
152155
);
@@ -159,7 +162,7 @@ bool debugMaybeDispatchObjectCreated(String library, String className, Object ob
159162
/// Should be called only from within an assert.
160163
///
161164
/// Returns true to make it easier to be wrapped into `assert`.
162-
bool debugMaybeDispatchObjectDisposed(Object object) {
165+
bool debugMaybeDispatchDisposed(Object object) {
163166
if (kFlutterMemoryAllocationsEnabled) {
164167
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: object);
165168
}

packages/flutter/test/foundation/debug_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ void main() {
6666
FlutterMemoryAllocations.instance.removeListener(listener);
6767
});
6868

69-
test('debugMaybeDispatchObjectCreated', () async {
70-
debugMaybeDispatchObjectCreated('library', 'class', object);
69+
test('debugMaybeDispatchCreated', () async {
70+
debugMaybeDispatchCreated('library', 'class', object);
7171

7272
if (kFlutterMemoryAllocationsEnabled) {
7373
final ObjectEvent? theEvent = dispatchedEvent;
@@ -77,15 +77,15 @@ void main() {
7777
}
7878

7979
expect(theEvent.object, object);
80-
expect(theEvent.library, 'library');
80+
expect(theEvent.library, 'package:flutter/library.dart');
8181
expect(theEvent.className, 'class');
8282
} else {
8383
expect(dispatchedEvent, isNull);
8484
}
8585
});
8686

87-
test('debugMaybeDispatchObjectDisposed', () async {
88-
debugMaybeDispatchObjectDisposed(object);
87+
test('debugMaybeDispatchDisposed', () async {
88+
debugMaybeDispatchDisposed(object);
8989

9090
if (kFlutterMemoryAllocationsEnabled) {
9191
final ObjectEvent? theEvent = dispatchedEvent;

0 commit comments

Comments
 (0)