@@ -40,9 +40,10 @@ void main(List<String> args) {
40
40
),
41
41
);
42
42
}
43
- contents = '# Changelog\n\n ${(sections .toList ()..sort ((a , b ) {
44
- return compareVersions (b .version , a .version );
45
- })).map ((e ) => e .toString ()).join ('\n ' )}' ;
43
+ contents =
44
+ '# Changelog\n\n ${(sections .toList ()..sort ((a , b ) {
45
+ return compareVersions (b .version , a .version );
46
+ })).map ((e ) => e .toString ()).join ('\n ' )}' ;
46
47
47
48
file.writeAsStringSync (contents);
48
49
print ('Changelog updated with version $version .' );
@@ -59,8 +60,9 @@ Set<_VersionSection> extractSections(String contents) {
59
60
final end = i + 1 < allVersionMatches.length ? allVersionMatches[i + 1 ].start : contents.length;
60
61
final sectionContents = contents.substring (start, end).trim ();
61
62
final lines = sectionContents.split ('\n ' ).where ((line) => line.isNotEmpty).toList ();
62
- final version =
63
- allVersionMatches[i].group (0 )! .substring (4 , allVersionMatches[i].group (0 )! .length - 1 );
63
+ final version = allVersionMatches[i]
64
+ .group (0 )!
65
+ .substring (4 , allVersionMatches[i].group (0 )! .length - 1 );
64
66
var releasedAt = DateTime .now ().toUtc ();
65
67
final updates = < String > {};
66
68
final old = lines
@@ -76,13 +78,7 @@ Set<_VersionSection> extractSections(String contents) {
76
78
updates.add (line);
77
79
}
78
80
}
79
- results.add (
80
- _VersionSection (
81
- version: version,
82
- releasedAt: releasedAt,
83
- updates: updates,
84
- ),
85
- );
81
+ results.add (_VersionSection (version: version, releasedAt: releasedAt, updates: updates));
86
82
}
87
83
88
84
return results;
@@ -103,11 +99,8 @@ class _VersionSection {
103
99
//
104
100
//
105
101
106
- _VersionSection ({
107
- required this .version,
108
- required this .releasedAt,
109
- this .updates = const {},
110
- });
102
+ _VersionSection ({required this .version, required this .releasedAt, Set <String >? updates})
103
+ : this .updates = updates ?? {};
111
104
112
105
//
113
106
//
0 commit comments