@@ -310,7 +310,7 @@ void Engine::DispatchPlatformMessage(
310310 return ;
311311 }
312312
313- // If there's no runtime_, we need to buffer some navigation messages .
313+ // If there's no runtime_, we may still need to set the initial route .
314314 if (message->channel () == kNavigationChannel )
315315 HandleNavigationPlatformMessage (std::move (message));
316316}
@@ -341,10 +341,10 @@ bool Engine::HandleNavigationPlatformMessage(
341341 return false ;
342342 auto root = document.GetObject ();
343343 auto method = root.FindMember (" method" );
344- if (method == root. MemberEnd () || method ->value != " pushRoute " )
344+ if (method->value != " setInitialRoute " )
345345 return false ;
346-
347- pending_push_route_message_ = std::move (message );
346+ auto route = root. FindMember ( " args " );
347+ initial_route_ = std::move (route-> value . GetString () );
348348 return true ;
349349}
350350
@@ -427,8 +427,6 @@ void Engine::ConfigureRuntime(const std::string& script_uri) {
427427 runtime_->SetViewportMetrics (viewport_metrics_);
428428 runtime_->SetLocale (language_code_, country_code_);
429429 runtime_->SetSemanticsEnabled (semantics_enabled_);
430- if (pending_push_route_message_)
431- runtime_->DispatchPlatformMessage (std::move (pending_push_route_message_));
432430}
433431
434432void Engine::DidCreateMainIsolate (Dart_Isolate isolate) {
@@ -450,6 +448,13 @@ void Engine::StartAnimatorIfPossible() {
450448 animator_->Start ();
451449}
452450
451+ std::string Engine::DefaultRouteName () {
452+ if (!initial_route_.empty ()) {
453+ return initial_route_;
454+ }
455+ return " /" ;
456+ }
457+
453458void Engine::ScheduleFrame () {
454459 animator_->RequestFrame ();
455460}
0 commit comments