未验证 提交 6585f334 编写于 作者: C Chinmay Garde 提交者: GitHub

Allow all entrypoints support by the command line VM. (#7717)

上级 ce073991
......@@ -168,12 +168,26 @@ void _drawFrame() {
_invoke(window.onDrawFrame, window._onDrawFrameZone);
}
// ignore: always_declare_return_types, prefer_generic_function_type_aliases
typedef _UnaryFunction(Null args);
// ignore: always_declare_return_types, prefer_generic_function_type_aliases
typedef _BinaryFunction(Null args, Null message);
@pragma('vm:entry-point')
// ignore: unused_element
void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) {
startMainIsolateFunction((){
runZoned<Future<void>>(() {
userMainFunction();
const List<String> empty_args = <String>[];
if (userMainFunction is _BinaryFunction) {
// This seems to be undocumented but supported by the command line VM.
// Let's do the same in case old entry-points are ported to Flutter.
(userMainFunction as dynamic)(empty_args, '');
} else if (userMainFunction is _UnaryFunction) {
(userMainFunction as dynamic)(empty_args);
} else {
userMainFunction();
}
}, onError: (Object error, StackTrace stackTrace) {
_reportUnhandledException(error.toString(), stackTrace.toString());
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册