File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
13
13
"github.com/go-flutter-desktop/go-flutter/embedder"
14
14
"github.com/go-flutter-desktop/go-flutter/internal/execpath"
15
15
"github.com/go-flutter-desktop/go-flutter/internal/opengl"
16
+ "github.com/go-flutter-desktop/go-flutter/plugin"
16
17
)
17
18
18
19
// Run executes a flutter application with the provided options.
@@ -270,6 +271,16 @@ func (a *Application) Run() error {
270
271
}
271
272
}
272
273
274
+ // Change the flutter initial route
275
+ initialRoute := os .Getenv ("GOFLUTTER_ROUTE" )
276
+ if initialRoute != "" {
277
+ defaultPlatformPlugin .flutterInitialized = func () {
278
+ plugin .
279
+ NewMethodChannel (messenger , "flutter/navigation" , plugin.JSONMethodCodec {}).
280
+ InvokeMethod ("pushRoute" , initialRoute )
281
+ }
282
+ }
283
+
273
284
// Setup a new windowManager to handle windows pixel ratio's and pointer
274
285
// devices.
275
286
windowManager := newWindowManager (a .config .forcePixelRatio )
Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ type platformPlugin struct {
19
19
glfwTasker * tasker.Tasker
20
20
window * glfw.Window
21
21
channel * plugin.MethodChannel
22
+
23
+ // flutterInitialized gets called once flutter is running and ready
24
+ // to process upstream plugin calls. (It usually takes ~10 rendering frame).
25
+ flutterInitialized func ()
22
26
}
23
27
24
28
// hardcoded because there is no swappable renderer interface.
25
29
var defaultPlatformPlugin = & platformPlugin {
26
- popBehavior : PopBehaviorNone ,
30
+ popBehavior : PopBehaviorNone ,
31
+ flutterInitialized : func () {},
27
32
}
28
33
29
34
var _ Plugin = & platformPlugin {} // compile-time type check
@@ -104,5 +109,8 @@ func (p *platformPlugin) handleWindowSetTitle(arguments interface{}) (reply inte
104
109
p .glfwTasker .Do (func () {
105
110
p .window .SetTitle (appSwitcherDescription .Label )
106
111
})
112
+
113
+ p .flutterInitialized ()
114
+
107
115
return nil , nil
108
116
}
You can’t perform that action at this time.
0 commit comments