ookami-kb / storybook_flutter

A storybook for Flutter widgets.
https://pub.dev/packages/storybook_flutter
MIT License
293 stars 66 forks source link

Unsupported operation: Undetermined Nullability with storybook 0.5.0 (or master) and flutter stable #31

Closed SarukaUsagi closed 3 years ago

SarukaUsagi commented 3 years ago

Hello, i'm trying to upgrade to v0.5, but i get a weird exception when launching my storybook on chrome. I get the same error when i try to launch the example of this repo (packages/storybook_flutter/example) and this is the stacktrace :

> example git:(master) ✗ flutter run -d chrome
Running "flutter pub get" in example...                          1 277ms
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...          
Unhandled exception:
Unsupported operation: Undetermined Nullability
#0      ProgramCompiler._emitFutureOrType (package:dev_compiler/src/kernel/compiler.dart:2857:7)
#1      ProgramCompiler._normalizeFutureOr (package:dev_compiler/src/kernel/compiler.dart:2730:12)
#2      ProgramCompiler.visitFutureOrType (package:dev_compiler/src/kernel/compiler.dart:2739:7)
#3      FutureOrType.accept (package:kernel/ast.dart:9269:42)
#4      ProgramCompiler._emitType (package:dev_compiler/src/kernel/compiler.dart:2655:54)
#5      ProgramCompiler._emitTypeNames (package:dev_compiler/src/kernel/compiler.dart:3048:56)
#6      ProgramCompiler.visitFunctionType (package:dev_compiler/src/kernel/compiler.dart:2937:24)
#7      ProgramCompiler._emitFunctionTagged (package:dev_compiler/src/kernel/compiler.dart:2611:19)
#8      ProgramCompiler.visitFunctionExpression (package:dev_compiler/src/kernel/compiler.dart:5866:12)
#9      FunctionExpression.accept (package:kernel/ast.dart:6735:44)
#10     ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:3623:20)
#11     ProgramCompiler._emitArgumentList (package:dev_compiler/src/kernel/compiler.dart:5315:11)
#12     ProgramCompiler._emitMethodCall (package:dev_compiler/src/kernel/compiler.dart:4633:16)
#13     ProgramCompiler.visitInstanceInvocation (package:dev_compiler/src/kernel/compiler.dart:4558:12)
#14     InstanceInvocation.accept (package:kernel/ast.dart:4536:44)
#15     ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:3623:20)
#16     ProgramCompiler.visitReturnStatement (package:dev_compiler/src/kernel/compiler.dart:4152:38)
#17     ReturnStatement.accept (package:kernel/ast.dart:7786:43)
#18     ProgramCompiler._visitStatement (package:dev_compiler/src/kernel/compiler.dart:3551:20)
#19     ProgramCompiler._emitFunctionScopedBody (package:dev_compiler/src/kernel/compiler.dart:3562:18)
#20     ProgramCompiler._emitSyncFunctionBody.<anonymous closure> (package:dev_compiler/src/kernel/compiler.dart:3355:17)
#21     ProgramCompiler._withLetScope (package:dev_compiler/src/kernel/compiler.dart:2235:25)
#22     ProgramCompiler._withCurrentFunction (package:dev_compiler/src/kernel/compiler.dart:3389:18)
#23     ProgramCompiler._emitSyncFunctionBody (package:dev_compiler/src/kernel/compiler.dart:3351:17)
#24     ProgramCompiler._emitFunction (package:dev_compiler/src/kernel/compiler.dart:3165:11)
#25     ProgramCompiler._emitLibraryFunction (package:dev_compiler/src/kernel/compiler.dart:2591:14)
#26     MappedIterator.moveNext (dart:_internal/iterable.dart:389:20)
#27     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:198:26)
#28     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#29     new List.of (dart:core-patch/array_patch.dart:50:28)
#30     Iterable.toList (dart:core/iterable.dart:366:12)
#31     ProgramCompiler._emitLibraryProcedures (package:dev_compiler/src/kernel/compiler.dart:2557:10)
#32     ProgramCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler.dart:530:7)
#33     List.forEach (dart:core-patch/growable_array.dart:403:8)
#34     ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:394:15)
#35     JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:144:33)
<asynchronous suspension>
#36     FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:632:5)
<asynchronous suspension>
#37     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:545:9)
<asynchronous suspension>
#38     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1105:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
Failed to compile application.

Waiting for connection from debug service on Chrome...             36,4s

I didn't have any problem lauching the v0.4.0 on the chrome device. The v0.5.0 is working perfectly on my android device (and i really like the new ControlPanel).

Thank you for all your work on the storybook and i hope you can help me to get rid of this "Undetermined Nullability" ^^

> example git:(master) ✗ flutter doctor   
[✓] Flutter (Channel stable, 2.0.4, on Mac OS X 10.15.7 19H524 darwin-x64, locale fr-FR)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.3)
[✓] VS Code (version 1.55.1)
[✓] Connected device (2 available)
ookami-kb commented 3 years ago

Thank you!

Yeah, this is some weird bug that happens for me as well for the web version. I cannot find the root cause of it yet (or any information about it at all).

And it's only there in the debug mode, when building the production version with flutter build web, it's all good. So workaround for now could be using other platforms for development and building web version for production.

udiedrichsen commented 3 years ago

It also happens in the beta channel:

Flutter 2.1.0-12.2.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 5bedb7b1d5 (4 weeks ago) • 2021-03-17 17:06:30 -0700 Engine • revision 711ab3fda0 Tools • Dart 2.13.0 (build 2.13.0-116.0.dev)

rayliverified commented 3 years ago

Could this issue be caused by device_preview?

image

ookami-kb commented 3 years ago

Doesn't look like it, still the same error after removing this dependency completely.

rayliverified commented 3 years ago

That's unfortunate! This is caused by the migration to null safety? Perhaps there's a file that is commented as excluded from null safety.

NunoObjr commented 3 years ago

Same thing here unnfortunatly, i also tried deliting hte device_preview, but no succed too

rayliverified commented 3 years ago

Unfortuanately, even after looking through the current source code, I don't see any errors. The next step would be to try rerunning the migration from v0.4?

ookami-kb commented 3 years ago

Yeah, I will go through all the changes in the near future, and will try to at least narrow down the search area.

rayliverified commented 3 years ago

Thank you so much for the fix!