Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

CompileError: Could not find declaration "runApp" on flutter 3.3.0 #8

Closed
zmtzawqlp opened this issue Sep 8, 2022 · 4 comments
Closed

Comments

@zmtzawqlp
Copy link

i am follow the readme, add flutter_eval.json into project and run dart_eval compile -o program.evc, get some error, would you please check it if you have time, thanks.

demo.zip

CompileError: Could not find declaration "runApp"
#0      IdentifierReference.getValue (package:dart_eval/src/eval/compiler/reference.dart:199:57)
#1      compileIdentifier (package:dart_eval/src/eval/compiler/expression/identifier.dart:13:48)
#2      compileMethodInvocation (package:dart_eval/src/eval/compiler/expression/method_invocation.dart:30:20)
#3      compileExpression (package:dart_eval/src/eval/compiler/expression/expression.dart:28:12)
#4      compileExpressionAndDiscardResult (package:dart_eval/src/eval/compiler/expression/expression.dart:76:5)
#5      compileStatement (package:dart_eval/src/eval/compiler/statement/statement.dart:21:5)
#6      compileBlock (package:dart_eval/src/eval/compiler/statement/block.dart:16:20)
#7      compileFunctionDeclaration (package:dart_eval/src/eval/compiler/declaration/function.dart:50:14)
#8      compileDeclaration (package:dart_eval/src/eval/compiler/declaration/declaration.dart:20:5)
#9      Compiler.compileSources.<anonymous closure>.<anonymous closure> (package:dart_eval/src/eval/compiler/compiler.dart:301:9)
#10     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
#11     Compiler.compileSources.<anonymous closure> (package:dart_eval/src/eval/compiler/compiler.dart:290:13)
#12     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
#13     Compiler.compileSources (package:dart_eval/src/eval/compiler/compiler.dart:287:30)
#14     Compiler.compile (package:dart_eval/src/eval/compiler/compiler.dart:117:12)
#15     main (file:///Users/zmt/.pub-cache/hosted/pub.flutter-io.cn/dart_eval-0.4.5/bin/dart_eval.dart:103:36)
#16     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
@ethanblake4
Copy link
Owner

Hi, flutter_eval does not support runApp. That's because you are supposed to use it inside of an existing Flutter app, which is already calling runApp. So, you can just comment out the runApp part, or even the entire main function. Instead of calling main in EvalWidget, you should specify a widget constructor, like "MyApp." (don't forget the .)

@zmtzawqlp
Copy link
Author

u should specify a widget constructo

thanks for quick reply, it's better to add those comments to readme, and give the user a full successful steps. thanks

@ethanblake4
Copy link
Owner

Added documentation to readme in ccb607e. Closing

@zmtzawqlp
Copy link
Author

zmtzawqlp commented Sep 23, 2022

still has some error. after i change as readme said:

Widget main() {
  // do any setup, then
  return MyApp();
}
// void main() {
//   //runApp(const MyApp());
// }

dart_eval: 0.4.7

Unhandled exception:
Null check operator used on a null value
#0      _resolveImportsAndExports.<anonymous closure> (package:dart_eval/src/eval/compiler/compiler.dart:620:87)
#1      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#2      ListIterable.toSet (dart:_internal/iterable.dart:218:18)
#3      _resolveImportsAndExports (package:dart_eval/src/eval/compiler/compiler.dart:620:90)
#4      Compiler.compileSources (package:dart_eval/src/eval/compiler/compiler.dart:165:9)
#5      Compiler.compile (package:dart_eval/src/eval/compiler/compiler.dart:118:12)
#6      main (file:///Users/zmtzawqlp/Documents/github/hot_update/flutter_eval/dart_eval/bin/dart_eval.dart:103:36)
#7      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

Repository owner locked and limited conversation to collaborators Sep 23, 2022
@ethanblake4 ethanblake4 converted this issue into discussion #9 Sep 23, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants