@@ -360,32 +360,32 @@ class ToolConfiguration {
360360 List <String > findCommand ([String prefix = '' ]) {
361361 List <String > command;
362362 // If the command key is given, then it applies to all platforms.
363- var commandFrom = toolMap.containsKey ('${prefix }command' )
363+ var commandFromKey = toolMap.containsKey ('${prefix }command' )
364364 ? '${prefix }command'
365365 : '$prefix ${Platform .operatingSystem }' ;
366- if (toolMap.containsKey (commandFrom)) {
367- if (toolMap[commandFrom].value is String ) {
368- command = [toolMap[commandFrom].toString ()];
366+ if (toolMap.containsKey (commandFromKey)) {
367+ var commandFrom = toolMap[commandFromKey] as YamlNode ;
368+ if (commandFrom.value is String ) {
369+ command = [commandFrom.toString ()];
369370 if (command[0 ].isEmpty) {
370371 throw DartdocOptionError (
371372 'Tool commands must not be empty. Tool $name command entry '
372- '"$commandFrom " must contain at least one path.' );
373+ '"$commandFromKey " must contain at least one path.' );
373374 }
374- } else if (toolMap[commandFrom] is YamlList ) {
375- command = (toolMap[commandFrom] as YamlList )
376- .map <String >((node) => node.toString ())
377- .toList ();
375+ } else if (commandFrom is YamlList ) {
376+ command =
377+ commandFrom.map <String >((node) => node.toString ()).toList ();
378378 if (command.isEmpty) {
379379 throw DartdocOptionError (
380380 'Tool commands must not be empty. Tool $name command entry '
381- '"$commandFrom " must contain at least one path.' );
381+ '"$commandFromKey " must contain at least one path.' );
382382 }
383383 } else {
384384 throw DartdocOptionError (
385385 'Tool commands must be a path to an executable, or a list of '
386386 'strings that starts with a path to an executable. '
387- 'The tool $name has a $commandFrom entry that is a '
388- '${toolMap [ commandFrom ] .runtimeType }' );
387+ 'The tool $name has a $commandFromKey entry that is a '
388+ '${commandFrom .runtimeType }' );
389389 }
390390 }
391391 return command;
@@ -637,16 +637,17 @@ abstract class DartdocOption<T> {
637637 _OptionValueWithContext <Object > valueWithContext, String missingFilename);
638638
639639 /// Call [_onMissing] for every path that does not exist.
640- void _validatePaths (_OptionValueWithContext <dynamic > valueWithContext) {
640+ void _validatePaths (_OptionValueWithContext <Object > valueWithContext) {
641641 if (! mustExist) return ;
642642 assert (isDir || isFile);
643643 List <String > resolvedPaths;
644- if (valueWithContext.value is String ) {
644+ var value = valueWithContext.value;
645+ if (value is String ) {
645646 resolvedPaths = [valueWithContext.resolvedValue];
646- } else if (valueWithContext. value is List <String >) {
647- resolvedPaths = valueWithContext.resolvedValue. toList () ;
648- } else if (valueWithContext. value is Map <String , String >) {
649- resolvedPaths = valueWithContext.resolvedValue.values.toList ();
647+ } else if (value is List <String >) {
648+ resolvedPaths = valueWithContext.resolvedValue as List ;
649+ } else if (value is Map <String , String >) {
650+ resolvedPaths = ( valueWithContext.resolvedValue as Map ) .values.toList ();
650651 } else {
651652 assert (
652653 false ,
@@ -1159,19 +1160,18 @@ abstract class _DartdocFileOption<T> implements DartdocOption<T> {
11591160 _OptionValueWithContext <Object > _valueAtFromFile (Folder dir) {
11601161 var yamlFileData = _yamlAtDirectory (dir);
11611162 var contextPath = yamlFileData.canonicalDirectoryPath;
1162- dynamic yamlData = yamlFileData.data ?? {};
1163+ Object yamlData = yamlFileData.data ?? {};
11631164 for (var key in keys) {
1164- if (! yamlData.containsKey (key)) return null ;
1165- yamlData = yamlData[key] ?? {};
1165+ if (yamlData is Map && ! yamlData.containsKey (key)) return null ;
1166+ yamlData = ( yamlData as Map ) [key] ?? {};
11661167 }
11671168
1168- dynamic returnData;
1169+ Object returnData;
11691170 if (_isListString) {
11701171 if (yamlData is YamlList ) {
1171- returnData = < String > [];
1172- for (var item in yamlData) {
1173- returnData.add (item.toString ());
1174- }
1172+ returnData = [
1173+ for (var item in yamlData) item.toString (),
1174+ ];
11751175 }
11761176 } else if (yamlData is YamlMap ) {
11771177 // TODO(jcollins-g): This special casing is unfortunate. Consider
@@ -1739,7 +1739,7 @@ Future<List<DartdocOption<Object>>> createDartdocOptions(
17391739 help: 'Generate ONLY the docs for the Dart SDK.' ),
17401740 DartdocOptionArgSynth <String >('sdkDir' ,
17411741 (DartdocSyntheticOption <String > option, Folder dir) {
1742- if (! option.parent['sdkDocs' ].valueAt (dir) &&
1742+ if (! ( option.parent['sdkDocs' ].valueAt (dir) as bool ) &&
17431743 (option.root['topLevelPackageMeta' ].valueAt (dir) as PackageMeta )
17441744 .requiresFlutter) {
17451745 String flutterRoot = option.root['flutterRoot' ].valueAt (dir);
0 commit comments