From 34c092f2b3aefa24d8e76fd260470889ce2f4e81 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 30 Jun 2023 11:07:54 -0700 Subject: [PATCH] Remove an unnecessary assert (#129796) The type variable `T`, when used as an expression, will always be a `Type`. The type test `T is! List` is always true (as is `T is Type`). This expression will become a warning in the analyzer in some upcoming release of the Dart SDK. This `assert` was added in a PR which reapplied an earlier PR, however the earlier PR did not include this assert. I do not see any discussion indicating the intent of this assert. The impact of testing this `T` in any way is low - this is a private class so we can see all the uses and know that the only type bound to `T` is `Uri`. Avoid the upcoming diagnostic and remove the assert entirely. This maintains existing behavior but ignores the potential intent for the check. --- packages/flutter_tools/lib/src/protocol_discovery.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/protocol_discovery.dart b/packages/flutter_tools/lib/src/protocol_discovery.dart index d21e602d2d6..578052bfb78 100644 --- a/packages/flutter_tools/lib/src/protocol_discovery.dart +++ b/packages/flutter_tools/lib/src/protocol_discovery.dart @@ -167,7 +167,6 @@ class _BufferedStreamController { final StreamController streamControllerInstance = StreamController.broadcast(); streamControllerInstance.onListen = () { for (final dynamic event in _events) { - assert(T is! List); if (event is T) { streamControllerInstance.add(event); } else {