Dart / Flutter: async behaviour of an Isolate'

2019-08-02 20:56发布

问题:

Aye Aye good people, I'm experiencing a weird behavior

when using the top level function of an isolate asynchronously;

you can find example code HERE, but in short

as top level function of an isolate this works:

String _syncHandle(int data) {
  return 'done';
}

and this doesn't:

Future<String> _syncHandle(int data) async {
  return 'done';
}

can anybody explain me why?

(or if should work, why isn't doing so in my code?)

thank you in advance

Francesco

...

[edit: just noticed that a similar question has been asked,

nevertheless it is still unanswered Call async function from Isolate function,

plus issue open on github ]