Skip to content

type 'Null' is not a subtype of type 'List<String>' in type cast #3365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonasfj opened this issue Mar 15, 2023 · 1 comment · Fixed by #3372
Closed

type 'Null' is not a subtype of type 'List<String>' in type cast #3365

jonasfj opened this issue Mar 15, 2023 · 1 comment · Fixed by #3372
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jonasfj
Copy link
Member

jonasfj commented Mar 15, 2023

I didn't check if this is fixed in the master branch, but it appears for a few packages on pub.dev

$ export FLUTTER_ROOT=/workspace/flutter
$ ./reproduce-dartdoc-issue.sh input_country 2.1.0
Package dartdoc is currently active at version 6.2.0.
The package dartdoc is already activated at newest available version.
To recompile executables, first run `dart pub global deactivate dartdoc`.
Installed executable dartdoc.
Activated dartdoc 6.2.0.
Documenting input_country...                                                                                                                                                                                                           -
dartdoc 6.2.0 (/jonasfj/.pub-cache/global_packages/dartdoc/bin/dartdoc.dart-2.19.4.snapshot) failed: type 'Null' is not a subtype of type 'List<String>' in type cast
#0      _DartdocFileOption._valueAtFromFile (package:dartdoc/src/dartdoc_options.dart:967:47)
#1      _DartdocFileOption._valueAtFromFilesFirstFound (package:dartdoc/src/dartdoc_options.dart:892:15)
#2      _DartdocFileOption._valueAtFromFiles (package:dartdoc/src/dartdoc_options.dart:880:28)
#3      DartdocOptionArgFile.valueAt (package:dartdoc/src/dartdoc_options.dart:813:29)
#4      DartdocOptionContext.include (package:dartdoc/src/dartdoc_options.dart:1274:35)
#5      DartdocOptionContext.include (package:dartdoc/src/dartdoc_options.dart)
#6      PubPackageBuilder.getLibraries.<anonymous closure> (package:dartdoc/src/model/package_builder.dart:438:18)
#7      PubPackageBuilder._parseLibraries (package:dartdoc/src/model/package_builder.dart:252:30)
<asynchronous suspension>
#8      PubPackageBuilder.getLibraries (package:dartdoc/src/model/package_builder.dart:433:5)
<asynchronous suspension>
#9      PubPackageBuilder.buildPackageGraph (package:dartdoc/src/model/package_builder.dart:85:5)
<asynchronous suspension>
#10     Dartdoc.generateDocsBase (package:dartdoc/src/dartdoc.dart:202:24)
<asynchronous suspension>
#11     Dartdoc.generateDocs (package:dartdoc/src/dartdoc.dart:250:24)
<asynchronous suspension>
#12     Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/src/dartdoc.dart:288:9)
<asynchronous suspension>

Use the reproduce-dartdoc-issue.sh below to reproduce:

#!/bin/bash

set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

P="$1"
V="$2"

if [ -z "$P" ]; then
  echo 'usage: ./reproduce-dartdoc-issue.sh <package> <version>'
  exit 1;
fi

if [ -z "$V" ]; then
  echo 'usage: ./reproduce-dartdoc-issue.sh <package> <version>'
  exit 1;
fi

cd $(mktemp -d)
curl -L "https://pub.dev/api/packages/$P/versions/$V/archive.tar.gz" | tar -xz
dart pub global activate dartdoc
dartdoc
@jonasfj jonasfj added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 15, 2023
@jcollins-g jcollins-g added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Mar 15, 2023
@jcollins-g
Copy link
Contributor

It is still present at head. It's due to a bad dartdoc_options.yaml, but we shouldn't crash just because of bad input here. Fix incoming in #3372.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
2 participants