@@ -20,9 +20,10 @@ import 'dart:io' show Platform, stdout;
2020import 'package:analyzer/dart/element/element.dart' ;
2121import 'package:analyzer/file_system/file_system.dart' ;
2222import 'package:args/args.dart' ;
23- import 'package:dartdoc/dartdoc.dart' ;
2423import 'package:dartdoc/src/experiment_options.dart' ;
24+ import 'package:dartdoc/src/failure.dart' ;
2525import 'package:dartdoc/src/io_utils.dart' ;
26+ import 'package:dartdoc/src/package_meta.dart' ;
2627import 'package:dartdoc/src/source_linker.dart' ;
2728import 'package:dartdoc/src/tool_definition.dart' ;
2829import 'package:dartdoc/src/tool_runner.dart' ;
@@ -335,7 +336,7 @@ class _OptionValueWithContext<T> {
335336///
336337/// Use via implementations [DartdocOptionSet] , [DartdocOptionArgFile] ,
337338/// [DartdocOptionArgOnly] , and [DartdocOptionFileOnly] .
338- abstract class DartdocOption <T > {
339+ abstract class DartdocOption <T extends Object ? > {
339340 /// This is the value returned if we couldn't find one otherwise.
340341 final T ? defaultsTo;
341342
@@ -457,7 +458,7 @@ abstract class DartdocOption<T> {
457458
458459 /// The [DartdocOptionRoot] containing this object.
459460 DartdocOptionRoot get root {
460- DartdocOption p = this ;
461+ DartdocOption < dynamic > p = this ;
461462 while (p is ! DartdocOptionRoot ) {
462463 p = p.parent;
463464 }
@@ -467,7 +468,7 @@ abstract class DartdocOption<T> {
467468 /// All object names starting at the root.
468469 Iterable <String > get keys {
469470 var keyList = < String > [];
470- DartdocOption option = this ;
471+ DartdocOption < dynamic > option = this ;
471472 while (option is ! DartdocOptionRoot ) {
472473 keyList.add (option.name);
473474 option = option.parent;
@@ -490,10 +491,12 @@ abstract class DartdocOption<T> {
490491 /// type. If [mustExist] is true, will throw [DartdocFileMissing] for command
491492 /// line parameters and file paths in config files that don't point to
492493 /// corresponding files or directories.
493- T ? valueAt (Folder dir);
494+ // TODO(jcollins-g): use of dynamic. https://github.com/dart-lang/dartdoc/issues/2814
495+ dynamic valueAt (Folder dir);
494496
495497 /// Calls [valueAt] with the working directory at the start of the program.
496- T ? valueAtCurrent () => valueAt (_directoryCurrent);
498+ // TODO(jcollins-g): use of dynamic. https://github.com/dart-lang/dartdoc/issues/2814
499+ dynamic valueAtCurrent () => valueAt (_directoryCurrent);
497500
498501 late final Folder _directoryCurrent =
499502 resourceProvider.getFolder (_directoryCurrentPath);
@@ -523,8 +526,9 @@ abstract class DartdocOption<T> {
523526 return _children[name]! ;
524527 }
525528
526- /// Get the immediate child of this node named [name] as a [DartdocOption<U>] .
527- DartdocOption <U > getAs <U >(String name) => _children[name] as DartdocOption <U >;
529+ /// Get the immediate child of this node named [name] and its value at [dir] .
530+ U getValueAs <U extends Object ?>(String name, Folder dir) =>
531+ _children[name]? .valueAt (dir) as U ;
528532
529533 /// Apply the function [visit] to [this] and all children.
530534 void traverse (void Function (DartdocOption option) visit) {
0 commit comments