Skip to content

Commit 62e0887

Browse files
authored
Bump min Dart SDK to 3.9, reformat (#2251)
1 parent d26f79e commit 62e0887

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+689
-634
lines changed

.github/workflows/markdown.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
matrix:
7171
# Add macos-latest and/or windows-latest if relevant for this package.
7272
os: [ubuntu-latest]
73-
sdk: [3.4, dev]
73+
sdk: [3.9, dev]
7474
steps:
7575
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
7676
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c

pkgs/markdown/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Fix an issue with nested list structure when indented by tabs (#2172).
1111
* Deprecated `LinkContext` and `BlockParser.standardBlockSyntaxes`.
1212
Implementation members that should never have been made public.
13-
* Require Dart `^3.4.0`.
13+
* Require Dart `^3.9.0`.
1414

1515
## 7.3.0
1616

pkgs/markdown/analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ linter:
2323
- missing_whitespace_between_adjacent_strings
2424
- no_adjacent_strings_in_list
2525
- prefer_const_declarations
26-
- prefer_final_locals
2726
- prefer_final_in_for_each
27+
- prefer_final_locals
28+
- remove_deprecations_in_breaking_versions
2829
- unnecessary_await_in_return
2930
- unnecessary_raw_strings
3031
- use_if_null_to_convert_nulls_to_bools

pkgs/markdown/example/app.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ void _switchFlavor(Event e) {
131131
}
132132

133133
extension on NodeList {
134-
List<Node> get items => [
135-
for (var i = 0; i < length; i++) item(i)!,
136-
];
134+
List<Node> get items => [for (var i = 0; i < length; i++) item(i)!];
137135
}
138136

139137
extension on NamedNodeMap {

pkgs/markdown/lib/src/assets/case_folding.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,5 +1312,5 @@ const caseFoldingMap = {
13121312
"𞤞": "𞥀",
13131313
"𞤟": "𞥁",
13141314
"𞤠": "𞥂",
1315-
"𞤡": "𞥃"
1315+
"𞤡": "𞥃",
13161316
};

pkgs/markdown/lib/src/assets/html_entities.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,5 +2129,5 @@ const htmlEntitiesMap = {
21292129
"&zopf;": "𝕫",
21302130
"&zscr;": "𝓏",
21312131
"&zwj;": "‍",
2132-
"&zwnj;": "‌"
2132+
"&zwnj;": "‌",
21332133
};

pkgs/markdown/lib/src/ast.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,15 @@ class Element implements Node {
2525
Element(this.tag, this.children) : attributes = {};
2626

2727
/// Instantiates an empty, self-closing [tag] Element.
28-
Element.empty(this.tag)
29-
: children = null,
30-
attributes = {};
28+
Element.empty(this.tag) : children = null, attributes = {};
3129

3230
/// Instantiates a [tag] Element with no [children].
33-
Element.withTag(this.tag)
34-
: children = const [],
35-
attributes = {};
31+
Element.withTag(this.tag) : children = const [], attributes = {};
3632

3733
/// Instantiates a [tag] Element with a single Text child.
3834
Element.text(this.tag, String text)
39-
: children = [Text(text)],
40-
attributes = {};
35+
: children = [Text(text)],
36+
attributes = {};
4137

4238
/// Whether this element is self-closing.
4339
bool get isEmpty => children == null;

pkgs/markdown/lib/src/block_parser.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ class BlockParser {
5858
/// The collection of built-in block parsers.
5959
// TODO(kevmoo): this should be static const and private!
6060
// The fact that it's mutable is a BUG!
61-
@Deprecated('Implementation member. '
62-
'Will be removed or make static in the next release.')
61+
@Deprecated(
62+
'Implementation member. '
63+
'Will be removed or make static in the next release.',
64+
)
6365
final List<BlockSyntax> standardBlockSyntaxes = [
6466
const EmptyBlockSyntax(),
6567
const HtmlBlockSyntax(),
@@ -71,7 +73,7 @@ class BlockParser {
7173
const UnorderedListSyntax(),
7274
const OrderedListSyntax(),
7375
const LinkReferenceDefinitionSyntax(),
74-
const ParagraphSyntax()
76+
const ParagraphSyntax(),
7577
];
7678

7779
BlockParser(this.lines, this.document) {

pkgs/markdown/lib/src/block_syntaxes/alert_block_syntax.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ class AlertBlockSyntax extends BlockSyntax {
5757
// a Setext header.
5858
// Because indented code blocks cannot interrupt paragraphs, a line
5959
// matched CodeBlockSyntax is also paragraph continuation text.
60-
final otherMatched =
61-
parser.blockSyntaxes.firstWhere((s) => s.canParse(parser));
60+
final otherMatched = parser.blockSyntaxes.firstWhere(
61+
(s) => s.canParse(parser),
62+
);
6263
if ((otherMatched is ParagraphSyntax &&
6364
!lastLine.isBlankLine &&
6465
!codeFencePattern.hasMatch(lastLine.content)) ||
@@ -78,8 +79,10 @@ class AlertBlockSyntax extends BlockSyntax {
7879
@override
7980
Node parse(BlockParser parser) {
8081
// Parse the alert type from the first line.
81-
final type =
82-
pattern.firstMatch(parser.current.content)!.group(1)!.toLowerCase();
82+
final type = pattern
83+
.firstMatch(parser.current.content)!
84+
.group(1)!
85+
.toLowerCase();
8386
parser.advance();
8487
final childLines = parseChildLines(parser);
8588
// Recursively parse the contents of the alert.

pkgs/markdown/lib/src/block_syntaxes/block_syntax.dart

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,18 @@ abstract class BlockSyntax {
5050
/// Gets whether or not [parser]'s current line should end the previous block.
5151
static bool isAtBlockEnd(BlockParser parser) {
5252
if (parser.isDone) return true;
53-
return parser.blockSyntaxes
54-
.any((s) => s.canParse(parser) && s.canEndBlock(parser));
53+
return parser.blockSyntaxes.any(
54+
(s) => s.canParse(parser) && s.canEndBlock(parser),
55+
);
5556
}
5657

5758
/// Generates a valid HTML anchor from the inner text of [element].
58-
static String generateAnchorHash(Element element) =>
59-
element.children!.first.textContent
60-
.toLowerCase()
61-
.trim()
62-
.replaceAll(RegExp('[^a-z0-9 _-]'), '')
63-
.replaceAll(RegExp(r'\s'), '-');
59+
static String generateAnchorHash(Element element) => element
60+
.children!
61+
.first
62+
.textContent
63+
.toLowerCase()
64+
.trim()
65+
.replaceAll(RegExp('[^a-z0-9 _-]'), '')
66+
.replaceAll(RegExp(r'\s'), '-');
6467
}

0 commit comments

Comments
 (0)