Handle CR+LF end of line sequences in the license parser (#40718)
diff --git a/packages/flutter/lib/src/foundation/licenses.dart b/packages/flutter/lib/src/foundation/licenses.dart index 0844b62..285bd82 100644 --- a/packages/flutter/lib/src/foundation/licenses.dart +++ b/packages/flutter/lib/src/foundation/licenses.dart
@@ -180,11 +180,16 @@ currentLineIndent += 8; state = _LicenseEntryWithLineBreaksParserState.beforeParagraph; break; + case '\r': case '\n': case '\f': if (lines.isNotEmpty) { yield getParagraph(); } + if (text[currentPosition] == '\r' && currentPosition < text.length - 1 + && text[currentPosition + 1] == '\n') { + currentPosition += 1; + } lastLineIndent = 0; currentLineIndent = 0; currentParagraphIndentation = null;
diff --git a/packages/flutter/test/foundation/licenses_test.dart b/packages/flutter/test/foundation/licenses_test.dart index b223383..280c34b 100644 --- a/packages/flutter/test/foundation/licenses_test.dart +++ b/packages/flutter/test/foundation/licenses_test.dart
@@ -158,6 +158,7 @@ test('LicenseEntryWithLineBreaks - leading and trailing whitespace', () { expect(const LicenseEntryWithLineBreaks(null, ' \n\n ').paragraphs.toList(), isEmpty); + expect(const LicenseEntryWithLineBreaks(null, ' \r\n\r\n ').paragraphs.toList(), isEmpty); List<LicenseParagraph> paragraphs;