icapps / flutter-icapps-license

A library that generates code to display all the licenses for the used third party pacakges.
MIT License
9 stars 3 forks source link

Unhandled exception: type 'Null' is not a subtype of type 'String' in type cast #35

Open dumabg opened 2 years ago

dumabg commented 2 years ago

Unhandled exception: type 'Null' is not a subtype of type 'String' in type cast

0 new CachedPackage.fromJson (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/model/dto/config/cached_package.dart:26:38)

1 new PackageConfig.fromJson. (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/model/dto/config/package_config.dart:16:45)

2 MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)

3 ListIterator.moveNext (dart:_internal/iterable.dart:342:26)

4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)

5 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)

6 new List.of (dart:core-patch/array_patch.dart:51:28)

7 ListIterable.toList (dart:_internal/iterable.dart:213:44)

8 new PackageConfig.fromJson (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/model/dto/config/package_config.dart:17:12)

9 ConfigService.getConfigData (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/service/config_service.dart:31:41)

10 LicenseRepository.getLicenseDataForDependency (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/repo/license_repository.dart:58:32)

#11 GenerateCommand._getDependencyText (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/command/generate_command.dart:101:25) #12 GenerateCommand.generateLicenses (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/command/generate_command.dart:87:13) #13 LicenseGenerator.run (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/src/license_generator.dart:84:9) #14 main (file:///home/xxx/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/license_generator-1.0.3/bin/license_generator.dart:10:5) pub finished with exit code 255
vanlooverenkoen commented 2 years ago

Is it possible to create a small reproducible project.

dumabg commented 2 years ago

I remember that It works ok on my project with Flutter 2.x. Now when I trying again, it appears this error, but now I'd migrated to Flutter 3.0.5. I don't known if is a problem with a Flutter version.

vanlooverenkoen commented 2 years ago

Hmm we are using flutter 3.x on all our projects without issues. It is linked to a package that can not be fully parsed. Can you share your pubspec & pubspec.lock?

dumabg commented 2 years ago

` name: < PROJECT > description: < PROJECT > publish_to: "none" version: 2.1.2+16

environment: sdk: ">=2.17.1 <3.0.0" flutter: ">=1.17.0"

dependencies: dart_utils: git: url: https://gitlab+deploy-token-< TOKEN >@gitlab.com/< PROJECT >/lib-dart-dart_utils flutter_utils:
git: url: https://gitlab+deploy-token-< TOKEN >@gitlab.com/< PROJECT >/lib-flutter-flutter_utils messaging_service: git: url: https://github.com/dumabg/messaging_service.git bubble: ^1.2.1 country_picker: ^2.0.15 crypto: ^3.0.2 device_info_plus: ^4.0.0 extended_masked_text: ^2.3.1 firebase_analytics: ^9.1.8 firebase_auth: ^3.3.18 firebase_core: ^1.17.0 firebase_crashlytics: ^2.8.0 firebase_dynamic_links: ^4.2.4

firebase_performance: ^0.8.0+5

firebase_storage: ^10.2.16 flutter: sdk: flutter flutter_colorful_tab: ^0.1.0 flutter_localizations: sdk: flutter flutter_svg: ^1.0.3 form_field_validator: ^1.1.0 google_api_availability: ^3.0.1 google_sign_in: ^5.3.1 http: ^0.13.4 intl: ^0.17.0 maps_launcher: ^2.0.1 package_info_plus: ^1.4.2 protobuf: ^2.0.1 select_form_field: ^2.2.0 share_plus: ^4.0.4 sign_in_with_apple: ^4.0.0 transparent_image: ^2.0.0 url_launcher: ^6.1.2 whatsapp_unilink: ^2.0.1+1 flutter_keyboard_visibility: ^5.2.0 firebase_messaging: ^11.4.0 badges: ^2.0.2 youtube_player_flutter: ^8.1.0

dev_dependencies: flutter_launcher_icons: ^0.9.2 flutter_lints: ^2.0.1 flutter_test: sdk: flutter license_generator: ^1.0.3 mock_http: git: url: https://github.com/dumabg/mock_http.git

license_generator: fail_fast: false

flutter_gen: integrations: flutter_svg: true null_safety: true

flutter_native_splash: color: "#ffffff" image: assets/images/splash.jpg fullscreen: true

flutter_icons: image_path_android: "assets/images/icon-xxxhdpi.png" image_path_ios: "assets/images/icon-xxxhdpi-ios.png" android: true ios: true remove_alpha_ios: true

flutter: generate: true uses-material-design: true assets:

`

rwillemsandroid commented 2 years ago

Unable to reproduce so far. Had to remove the two gitlab and Github dependencies in order to successfully run pub get with the provided pubspec. Adding a random Gitlab hosted dependency did not cause any errors either at my side.

@dumabg Can you confirm that both private repositories are property setup with a version and LICENSE ? What OS are you using?

Please provide us with a minimum public accessible example to continue investigating this issue.

mgwrd commented 1 year ago

I'm having the same issue, here is a example to reproduce the error: https://github.com/mgwrd/license_generator_error So far I did not try to remove dependencies to isolate the error, but maybe someone can debug the license generator.