@@ -40,17 +40,12 @@ class _ProfiledBinaryMessenger implements BinaryMessenger {
4040
4141 Future <ByteData ?>? sendWithPostfix (String channel, String postfix, ByteData ? message) async {
4242 _debugRecordUpStream (channelTypeName, '$channel $postfix ' , codecTypeName, message);
43- TimelineTask ? debugTimelineTask;
44- if (! kReleaseMode) {
45- debugTimelineTask = TimelineTask ()..start ('Platform Channel send $channel $postfix ' );
46- }
43+ final TimelineTask timelineTask = TimelineTask ()..start ('Platform Channel send $channel $postfix ' );
4744 final ByteData ? result;
4845 try {
4946 result = await proxy.send (channel, message);
5047 } finally {
51- if (! kReleaseMode) {
52- debugTimelineTask! .finish ();
53- }
48+ timelineTask.finish ();
5449 }
5550 _debugRecordDownStream (channelTypeName, '$channel $postfix ' , codecTypeName, result);
5651 return result;
@@ -183,7 +178,7 @@ class BasicMessageChannel<T> {
183178 /// [BackgroundIsolateBinaryMessenger.ensureInitialized] .
184179 BinaryMessenger get binaryMessenger {
185180 final BinaryMessenger result = _binaryMessenger ?? _findBinaryMessenger ();
186- return ! kReleaseMode && debugProfilePlatformChannels
181+ return debugProfilePlatformChannels
187182 ? _debugBinaryMessengers[this ] ?? = _ProfiledBinaryMessenger (
188183 // ignore: no_runtimetype_tostring
189184 result, runtimeType.toString (), codec.runtimeType.toString ())
@@ -272,7 +267,7 @@ class MethodChannel {
272267 /// [BackgroundIsolateBinaryMessenger.ensureInitialized] .
273268 BinaryMessenger get binaryMessenger {
274269 final BinaryMessenger result = _binaryMessenger ?? _findBinaryMessenger ();
275- return ! kReleaseMode && debugProfilePlatformChannels
270+ return debugProfilePlatformChannels
276271 ? _debugBinaryMessengers[this ] ?? = _ProfiledBinaryMessenger (
277272 // ignore: no_runtimetype_tostring
278273 result, runtimeType.toString (), codec.runtimeType.toString ())
@@ -303,7 +298,7 @@ class MethodChannel {
303298 Future <T ?> _invokeMethod <T >(String method, { required bool missingOk, dynamic arguments }) async {
304299 final ByteData input = codec.encodeMethodCall (MethodCall (method, arguments));
305300 final ByteData ? result =
306- ! kReleaseMode && debugProfilePlatformChannels ?
301+ debugProfilePlatformChannels ?
307302 await (binaryMessenger as _ProfiledBinaryMessenger ).sendWithPostfix (name, '#$method ' , input) :
308303 await binaryMessenger.send (name, input);
309304 if (result == null ) {
0 commit comments