CompileError: Cannot call onClick as it is not a valid method at unknown
gnassro opened this issue · 2 comments
I try to add callback function to the code that i want to compile but i got this error:
dart_eval compile version1.evc
Loading files...
Found binding file: .dart_eval/bindings/flutter_eval.json
Compiling package eval_test...
Unhandled exception:
CompileError: Cannot call onClick as it is not a valid method at unknown (file package:eval_test/eval_test.dart)
#0 Compiler.compileSources (package:dart_eval/src/eval/compiler/compiler.dart:394:7)
#1 Compiler.compile (package:dart_eval/src/eval/compiler/compiler.dart:142:12)
#2 main (file:///Users/macbook/.pub-cache/hosted/pub.dev/dart_eval-0.6.0/bin/dart_eval.dart:129:36)
#3 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:33)
#4 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
library eval_test;
import 'package:flutter/material.dart';
class EvalTest extends StatelessWidget {
final void Function(String) onClick;
const EvalTest(this.onClick, {super.key});
@override
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
onPressed: () => onClick('rr'),
child: const Text('Click me'),
),
);
}
}
There's a demo video of a similar functionality with flutter_eval
here, you might find it useful.
Fixed in v0.7.0