diff --git a/engine/src/flutter/runtime/dart_service_isolate.cc b/engine/src/flutter/runtime/dart_service_isolate.cc index 2fb9932e4e..e819f6e97c 100644 --- a/engine/src/flutter/runtime/dart_service_isolate.cc +++ b/engine/src/flutter/runtime/dart_service_isolate.cc @@ -157,18 +157,6 @@ bool DartServiceIsolate::Startup(std::string server_ip, result = Dart_SetNativeResolver(library, GetNativeFunction, GetSymbol); SHUTDOWN_ON_ERROR(result); - // Make runnable. - Dart_ExitScope(); - Dart_ExitIsolate(); - *error = Dart_IsolateMakeRunnable(isolate); - if (*error) { - Dart_EnterIsolate(isolate); - Dart_ShutdownIsolate(); - return false; - } - Dart_EnterIsolate(isolate); - Dart_EnterScope(); - library = Dart_RootLibrary(); SHUTDOWN_ON_ERROR(library); @@ -202,6 +190,19 @@ bool DartServiceIsolate::Startup(std::string server_ip, library, Dart_NewStringFromCString("_enableServicePortFallback"), Dart_NewBoolean(enable_service_port_fallback)); SHUTDOWN_ON_ERROR(result); + + // Make runnable. + Dart_ExitScope(); + Dart_ExitIsolate(); + *error = Dart_IsolateMakeRunnable(isolate); + if (*error) { + Dart_EnterIsolate(isolate); + Dart_ShutdownIsolate(); + return false; + } + Dart_EnterIsolate(isolate); + Dart_EnterScope(); + return true; }