ethanblake4 / flutter_eval

Code push for Flutter, powered by dart_eval

Home Page:https://pub.dev/packages/flutter_eval

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter_eval demo error in flutter 3.3.2

zmtzawqlp opened this issue · comments

The following CompileError was thrown building EvalExample:
Unknown function body type ExpressionFunctionBodyImpl

The relevant error-causing widget was
EvalExample
lib/main.dart:7
When the exception was thrown, this was the stack
#0      compileMethodDeclaration
package:dart_eval/…/declaration/method.dart:56
#1      compileDeclaration
package:dart_eval/…/declaration/declaration.dart:18
#2      compileClassDeclaration
package:dart_eval/…/declaration/class.dart:29
#3      compileDeclaration
package:dart_eval/…/declaration/declaration.dart:16
#4      Compiler.compileSources.<anonymous closure>.<anonymous closure>
package:dart_eval/…/compiler/compiler.dart:303
#5      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
#6      Compiler.compileSources.<anonymous closure>
package:dart_eval/…/compiler/compiler.dart:292
#7      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
#8      Compiler.compileSources
package:dart_eval/…/compiler/compiler.dart:289
#9      Compiler.compile
package:dart_eval/…/compiler/compiler.dart:118
#10     _EvalWidgetState._recompile
package:flutter_eval/src/flutter_eval.dart:308
#11     _EvalWidgetState.initState
package:flutter_eval/src/flutter_eval.dart:288
#12     StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:5015
#13     ComponentElement.mount
package:flutter/…/widgets/framework.dart:4853
...     Normal element mounting (7 frames)
#20     Element.inflateWidget
package:flutter/…/widgets/framework.dart:3863
#21     Element.updateChild
package:flutter/…/widgets/framework.dart:3592
#22     RenderObjectToWidgetElement._rebuild
package:flutter/…/widgets/binding.dart:1195
#23     RenderObjectToWidgetElement.mount
package:flutter/…/widgets/binding.dart:1164
#24     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
package:flutter/…/widgets/binding.dart:1111
#25     BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2605
#26     RenderObjectToWidgetAdapter.attachToRenderTree
package:flutter/…/widgets/binding.dart:1110
#27     WidgetsBinding.attachRootWidget
package:flutter/…/widgets/binding.dart:945
#28     WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
package:flutter/…/widgets/binding.dart:925
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
commented

This is a known issue, I forgot to add arrow functions support on class methods. Will be fixed in v0.5 at the latest. In the meantime can replace functions like createState() => PageState() with eg createState() { return PageState(); }

new error after i change State<MyHomePage> createState() => _MyHomePageState(); to State<MyHomePage> createState() { return _MyHomePageState();}

Launching lib/main.dart on iPhone 13 Pro Max in debug mode...
Xcode build done.                                           14.2s
Connecting to VM Service at ws://127.0.0.1:49505/a240wrz7su8=/ws

════════ Exception caught by widgets library ═══════════════════════════════════
The following RuntimeException was thrown building $StatefulWidget$bridge(dirty, state: $State$bridge<StatefulWidget>#028b5):
dart_eval runtime exception: Stack Overflow
#0      _LinkedHashMapMixin._getValueOrData (dart:collection-patch/compact_hash.dart:567:3)
#1      _LinkedHashMapMixin.[] (dart:collection-patch/compact_hash.dart:594:13)
#2      $InstanceImpl.$getProperty

RUNTIME STATE
=============
Program offset: 3458
Stack sample: [$State$bridge<StatefulWidget>#028b5, Instance of '$BuildContext', null, null, null, null, null, null, null, null]
Call stack: [0, -1]
TRACE:
3452: PushObjectPropertyImpl (L0[0])
3453: Return (L1)
3454: PushScope (F35:952, '_MyHomePageState._counter (set)')
3455: SetObjectPropertyImpl (L0[0] = L1)
3456: Return (L1)
3457: PushScope (F35:987, '_MyHomePageState.build()')
3458: PushObjectProperty (L0.widget)  <<< EXCEPTION
3459: PushReturnValue ()
3460: PushObjectProperty (L2.title)
3461: PushReturnValue ()


The relevant error-causing widget was
$StatefulWidget$bridge $StatefulWidget$
When the exception was thrown, this was the stack
#0      Runtime.bridgeCall
#1      EvalStaticFunctionPtr.call
#2      $Bridge.$_invoke
#3      $State$bridge.build
#4      StatefulElement.build
#5      ComponentElement.performRebuild
#6      StatefulElement.performRebuild
#7      Element.rebuild
#8      ComponentElement._firstBuild
#9      StatefulElement._firstBuild
#10     ComponentElement.mount
...     Normal element mounting (24 frames)
#34     Element.inflateWidget
#35     MultiChildRenderObjectElement.inflateWidget
#36     MultiChildRenderObjectElement.mount
...     Normal element mounting (175 frames)
#211    Element.inflateWidget
#212    MultiChildRenderObjectElement.inflateWidget
#213    MultiChildRenderObjectElement.mount
...     Normal element mounting (436 frames)
#649    Element.inflateWidget
#650    Element.updateChild
#651    RenderObjectToWidgetElement._rebuild
#652    RenderObjectToWidgetElement.mount
#653    RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
#654    BuildOwner.buildScope
#655    RenderObjectToWidgetAdapter.attachToRenderTree
#656    WidgetsBinding.attachRootWidget
#657    WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
flutter: Wrote generated EVC bytecode to: file:///Users/zmtzawqlp/Library/Developer/CoreSimulator/Devices/D4462A35-FCBB-4827-964B-F54895926C98/data/Containers/Data/Application/452C35FF-F77F-4258-B23A-5C41E62729A3/Documents/assets/program.evc

commented

Ok, I know why this error is happening. It's very late for me now though, will fix tomorrow. You can remove the use of widget.title for now to test

Ok, I know why this error is happening. It's very late for me now though, will fix tomorrow. You can remove the use of widget.title for now to test

ok, thinks

commented

Fixed in v0.5