dart_eval
dart_eval copied to clipboard
dart_eval runtime exception: Expected a value of type 'Completer<dynamic>' when use a Future method with params
Hi I'm working with dart_eval and the current goal is to await an async function which has parameters. Without parameters everything is fine: `void start() async { await aa(); }
Future
Using parameters: `void start() async { await aa(10, ''); }
Future
dart_eval runtime exception: Expected a value of type 'Completer
' , but got one of type '$36int'
Hi, I can't reproduce this issue in dart_eval v0.6.5. I created the following test:
test('Future method with args', () async {
final runtime = compiler.compileWriteAndLoad({
'example': {
'main.dart': '''
Future start() async {
await aa(10, '');
print('done');
}
Future aa(int value, String tag) async {
await Future.delayed(const Duration(milliseconds: 1000));
}
'''
}
});
expect(() async {
final future =
runtime.executeLib('package:example/main.dart', 'start') as Future;
await expectLater(future, completion(null));
}, prints('done\n'));
});
and it completes successfully.