Skip to content

EXCEPTION CAUGHT BY WIDGETS LIBRARY #21042

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
benedicte69 opened this issue Aug 26, 2018 · 13 comments
Closed

EXCEPTION CAUGHT BY WIDGETS LIBRARY #21042

benedicte69 opened this issue Aug 26, 2018 · 13 comments
Labels
dependency: dart Dart team may need to help us

Comments

@benedicte69
Copy link

benedicte69 commented Aug 26, 2018

Performing hot restart...
Restarted app in 1 288ms.
I/flutter (10540): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (10540): The following assertion was thrown building MyApp(dirty, state: _State#fe0a2):
I/flutter (10540): type 'List<dynamic>' is not a subtype of type 'List<Widget>'
I/flutter (10540): 
I/flutter (10540): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (10540): more information in this error message to help you determine and fix the underlying cause.
I/flutter (10540): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (10540):   https://github.com/flutter/flutter/issues/new
code used:
[error_radios.txt](https://github.com/flutter/flutter/files/2321780/error_radios.txt)
@zoechi
Copy link
Contributor

zoechi commented Aug 26, 2018

Please add the output of flutter doctor -v
and more instructions about how to reproduce.

Looks like a dup of dart-lang/sdk#33076

@benedicte69
Copy link
Author

Thanks @zoechi, I have been said "Dart 2 uses what is call "strong mode" flag by default, in other words, you need to avoid to not properly type your variables." If you want to reproduce the error just paste the code used which is in the error_radios.txt I joined at the end of my initial post.

@benedicte69
Copy link
Author

a sample of flutter doctor -v

C:\Users\TOTO>flutter doctor -v
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [version 10.0.17134.228], locale fr-FR)
• Flutter version 0.5.1 at C:\Users\TOTO...\flutter
• Framework revision c7ea3ca (3 months ago), 2018-05-29 21:07:33 +0200
• Engine revision 1ed25ca
• Dart version 2.0.0-dev.58.0.flutter-f981f09760

[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at C:\Users\TOTO...
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = C:\Users\TOTO...
• Java binary at: C:\Users\TOTO...\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.

[√] Android Studio (version 3.1)
• Android Studio at C:\Users\TOTO...
• Flutter plugin version 27.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

C:\Users\TOTO>

@benedicte69
Copy link
Author

benedicte69 commented Aug 26, 2018

Hope it can help, I am too much beginner to understand. But, apparently before this revision c7ea3ca things were different and it was not necessary to change List radiosList = new List(); by List radiosList = List();

@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

Because your log was not wrapped in ``` the <dynamic> and `` parts were not visible.
This makes it clear now that this issue is not related to #33076

@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

You just need to change

List radiosList = new List();

to

List radiosList = new List<Widget>();

or

List<Widget> radiosList = new List<Widget>();

or

List<Widget> radiosList = [];

or

var /* or final */ radiosList = <Widget>[];

@zoechi zoechi closed this as completed Aug 27, 2018
@benedicte69
Copy link
Author

benedicte69 commented Aug 27, 2018 via email

@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

Any suggestion? I found the error message is clear.

@zoechi zoechi added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds dependency: dart Dart team may need to help us labels Aug 27, 2018
@benedicte69
Copy link
Author

benedicte69 commented Aug 27, 2018 via email

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 27, 2018
@no-response no-response bot reopened this Aug 27, 2018
@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

I see what you mean.

EXCEPTION CAUGHT BY WIDGETS LIBRARY

Is reported because Flutter acts as a framework that calls your code and it runs into an error when doing that.

I meant

type 'List' is not a subtype of type 'List'

should give a pretty good hint at what is wrong.
As you see from my answer above there are many valid options and it's hard for the compiler to make a more specific suggestion because the compiler can't know your intention.

@benedicte69
Copy link
Author

benedicte69 commented Aug 27, 2018 via email

@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

Great!

@zoechi zoechi closed this as completed Aug 27, 2018
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependency: dart Dart team may need to help us
Projects
None yet
Development

No branches or pull requests

2 participants