diff --git a/lib/src/warnings.dart b/lib/src/warnings.dart index 4e56905309..15d0aded9f 100644 --- a/lib/src/warnings.dart +++ b/lib/src/warnings.dart @@ -540,15 +540,17 @@ class PackageWarningCounter { bool get hasWarnings => _countedWarnings.isNotEmpty; /// Whether we've already warned for this combination of [element], [kind], - /// and [message]. - bool hasWarning(Warnable? element, PackageWarning kind, String message) { + /// and [messageFragment]. + bool hasWarning( + Warnable? element, PackageWarning kind, String messageFragment) { if (element == null) { return false; } final warning = _countedWarnings[element.element]; if (warning != null) { final messages = warning[kind]; - return messages != null && messages.contains(message); + return messages != null && + messages.any((message) => message.contains(messageFragment)); } return false; } diff --git a/test/documentation_comment_test.dart b/test/documentation_comment_test.dart index e9701a1a78..dceba6642d 100644 --- a/test/documentation_comment_test.dart +++ b/test/documentation_comment_test.dart @@ -451,8 +451,7 @@ Three.''')); libraryModel, hasInvalidParameterWarning( 'The {@animation ...} directive was called with invalid ' - 'parameters. FormatException: Could not find an option named ' - '"name".'), + 'parameters. FormatException: Could not find an option named'), ); }