@@ -46,7 +46,7 @@ class GalleryInfoBuilder extends Builder {
46
46
47
47
@override
48
48
Map <String , List <String >> get buildExtensions => const {
49
- '.dart' : const ['.gallery_info.json' ],
49
+ '.dart' : ['.gallery_info.json' ],
50
50
};
51
51
52
52
/// Resolve the docs and demos within all [configs] .
@@ -56,7 +56,7 @@ class GalleryInfoBuilder extends Builder {
56
56
Future <Iterable <ResolvedConfig >> _resolveConfigs (Iterable <ConfigInfo > configs,
57
57
LibraryElement rootLibrary, AssetReader assetReader) async =>
58
58
Future .wait (configs.map ((config) async {
59
- final resolved = new ResolvedConfig ()
59
+ final resolved = ResolvedConfig ()
60
60
..displayName = config.displayName
61
61
..benchmarks = config.benchmarks
62
62
..benchmarkPrefix = config.benchmarkPrefix
@@ -68,8 +68,7 @@ class GalleryInfoBuilder extends Builder {
68
68
Future .wait (_resolveDocs (config.docs, rootLibrary, assetReader)).then (
69
69
(docs) =>
70
70
resolved.docs = docs.where ((doc) => doc != null ).toList ()),
71
- Future
72
- .wait (_resolveDemos (
71
+ Future .wait (_resolveDemos (
73
72
config.demoClassNames, rootLibrary, assetReader))
74
73
.then ((demos) => resolved.demos =
75
74
demos.where ((demo) => demo != null ).toList ()),
@@ -108,7 +107,7 @@ class GalleryInfoBuilder extends Builder {
108
107
/// Read the [markdownAsset] with [assetReader] and render as HTML.
109
108
Future <DocInfo > _readMarkdownAsset (
110
109
String markdownAsset, AssetReader assetReader) async {
111
- final assetId = new AssetId .resolve (markdownAsset);
110
+ final assetId = AssetId .resolve (markdownAsset);
112
111
if (extension (assetId.path) != '.md' ) {
113
112
log.warning ('Generator only supports .md files as supplementary docs. '
114
113
'Can not insert $assetId into gallery.' );
@@ -124,7 +123,7 @@ class GalleryInfoBuilder extends Builder {
124
123
// Convert markdown to html and insert static server for images.
125
124
final htmlContent = _replaceImgTags (g3docMarkdownToHtml (content));
126
125
127
- return new DocInfo ()
126
+ return DocInfo ()
128
127
..name = basenameWithoutExtension (assetId.path)
129
128
..path = path_utils.assetToPath (assetId.toString ())
130
129
..comment = htmlContent;
@@ -137,7 +136,7 @@ class GalleryInfoBuilder extends Builder {
137
136
/// [assetReader] .
138
137
Future <DocInfo > _resolveDocFromClass (String identifier,
139
138
LibraryElement library, AssetReader assetReader) async {
140
- final libraryId = new AssetId .resolve (library.source.uri.toString ());
139
+ final libraryId = AssetId .resolve (library.source.uri.toString ());
141
140
final docClass = library.getType (identifier);
142
141
DocInfo docs;
143
142
@@ -160,15 +159,15 @@ class GalleryInfoBuilder extends Builder {
160
159
// classElement.documentationComment, classElement.metadata, etc are not
161
160
// populated in the resolved element model available here.
162
161
var libraryId =
163
- new AssetId .resolve (classElement.library.source.uri.toString ());
162
+ AssetId .resolve (classElement.library.source.uri.toString ());
164
163
docs =
165
164
await extractDocumentation (classElement.name, libraryId, assetReader);
166
165
167
166
if (docs == null ) {
168
167
// The super class must be defined in the library as a part file.
169
168
for (var part in classElement.library.parts) {
170
169
if (part.getType (classElement.name) != null ) {
171
- libraryId = new AssetId .resolve (part.source.uri.toString ());
170
+ libraryId = AssetId .resolve (part.source.uri.toString ());
172
171
docs = await extractDocumentation (
173
172
classElement.name, libraryId, assetReader);
174
173
}
@@ -235,7 +234,7 @@ class GalleryInfoBuilder extends Builder {
235
234
236
235
/// Replace web server in `<img>` tags with the [_staticImageServer] .
237
236
String _replaceImgTags (String content) => content.replaceAllMapped (
238
- new RegExp (r'<img alt="(.*)" src="(\S*g3doc\S+)" \/>' ),
237
+ RegExp (r'<img alt="(.*)" src="(\S*g3doc\S+)" \/>' ),
239
238
(Match m) => '<img alt="${m [1 ]}" src="$_staticImageServer ${m [2 ]}" />' );
240
239
241
240
/// Resolve all [demoClassNames] into [_DemoInfo] s.
@@ -263,15 +262,15 @@ class GalleryInfoBuilder extends Builder {
263
262
/// [assetReader] .
264
263
Future <DemoInfo > _resolveDemo (String demoClassName, LibraryElement library,
265
264
AssetReader assetReader) async {
266
- final libraryId = new AssetId .resolve (library.source.uri.toString ());
265
+ final libraryId = AssetId .resolve (library.source.uri.toString ());
267
266
final extractedDemo =
268
267
await extractDocumentation (demoClassName, libraryId, assetReader);
269
268
270
269
if (extractedDemo == null ) {
271
270
log.warning ('Failed to extract demo information from: $demoClassName .' );
272
271
return null ;
273
272
}
274
- return new DemoInfo ()
273
+ return DemoInfo ()
275
274
..type = extractedDemo.name
276
275
..name = extractedDemo.name
277
276
..selector = extractedDemo.selector
@@ -284,8 +283,8 @@ class GalleryInfoBuilder extends Builder {
284
283
/// Searches imports with a breadth-first search, as that should find
285
284
/// [identifier] faster than a depth-first search.
286
285
LibraryElement _searchFor (String identifier, LibraryElement rootLibrary) {
287
- final visited = new Set <LibraryElement >();
288
- final toVisit = new Queue <LibraryElement >();
286
+ final visited = Set <LibraryElement >();
287
+ final toVisit = Queue <LibraryElement >();
289
288
290
289
toVisit.add (rootLibrary);
291
290
0 commit comments