Documentation
¶
Overview ¶
Package embedder wraps the Flutter Embedder C API to Go.
The package contains some GLFW specific implementation helpers. These may be removed in the future.
If you wish to publish a Flutter application to desktop, you shouldn't use this package directly. Instead, use the go-flutter package. There is NO compatibility promise on this package (embedder). Breaking changes can and will occur.
Index ¶
- func CountFlutterEngines() int
- func FlutterEngineFlushPendingTasksNow()
- type FlutterEngine
- func (flu *FlutterEngine) Index() int
- func (flu *FlutterEngine) Run(userData unsafe.Pointer, vmArgs []string) Result
- func (flu *FlutterEngine) SendPlatformMessage(msg *PlatformMessage) Result
- func (flu *FlutterEngine) SendPlatformMessageResponse(responseTo PlatformMessageResponseHandle, encodedMessage []byte) Result
- func (flu *FlutterEngine) SendPointerEvent(event PointerEvent) Result
- func (flu *FlutterEngine) SendWindowMetricsEvent(event WindowMetricsEvent) Result
- func (flu *FlutterEngine) Shutdown() Result
- type PlatformMessage
- type PlatformMessageResponseHandle
- type PointerEvent
- type PointerPhase
- type PointerSignalKind
- type Result
- type WindowMetricsEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountFlutterEngines ¶
func CountFlutterEngines() int
CountFlutterEngines return the number of engines registered in this embedder.
func FlutterEngineFlushPendingTasksNow ¶
func FlutterEngineFlushPendingTasksNow()
FlutterEngineFlushPendingTasksNow flush tasks on a message loop not controlled by the Flutter engine.
deprecated soon.
Types ¶
type FlutterEngine ¶
type FlutterEngine struct { // Flutter Engine. Engine C.FlutterEngine // GL callback functions GLMakeCurrent func() bool GLClearCurrent func() bool GLPresent func() bool GLFboCallback func() int32 GLMakeResourceCurrent func() bool GLProcResolver func(procName string) unsafe.Pointer // platform message callback function PlatfromMessage func(message *PlatformMessage) // Engine arguments AssetsPath string IcuDataPath string // contains filtered or unexported fields }
FlutterEngine corresponds to the C.FlutterEngine with his associated callback's method.
func FlutterEngineByIndex ¶
func FlutterEngineByIndex(index int) (engine *FlutterEngine)
FlutterEngineByIndex returns an existing FlutterEngine by its index in this embedder. Deprecated 2019-04-05, this is not used by go-flutter anymore and may be removed in the future.
func NewFlutterEngine ¶
func NewFlutterEngine() *FlutterEngine
NewFlutterEngine creates an empty FlutterEngine and assigns it an index for global lookup.
func (*FlutterEngine) Index ¶
func (flu *FlutterEngine) Index() int
Index returns the index of the engine in the global flutterEngines slice Deprecated 2019-04-05, this is not used by go-flutter anymore and may be removed in the future.
func (*FlutterEngine) Run ¶
func (flu *FlutterEngine) Run(userData unsafe.Pointer, vmArgs []string) Result
Run launches the Flutter Engine in a background thread.
func (*FlutterEngine) SendPlatformMessage ¶
func (flu *FlutterEngine) SendPlatformMessage(msg *PlatformMessage) Result
SendPlatformMessage is used to send a PlatformMessage to the Flutter engine.
func (*FlutterEngine) SendPlatformMessageResponse ¶
func (flu *FlutterEngine) SendPlatformMessageResponse( responseTo PlatformMessageResponseHandle, encodedMessage []byte, ) Result
SendPlatformMessageResponse is used to send a message to the Flutter side using the correct ResponseHandle.
func (*FlutterEngine) SendPointerEvent ¶
func (flu *FlutterEngine) SendPointerEvent(event PointerEvent) Result
SendPointerEvent is used to send an PointerEvent to the Flutter engine.
func (*FlutterEngine) SendWindowMetricsEvent ¶
func (flu *FlutterEngine) SendWindowMetricsEvent(event WindowMetricsEvent) Result
SendWindowMetricsEvent is used to send a WindowMetricsEvent to the Flutter Engine.
func (*FlutterEngine) Shutdown ¶
func (flu *FlutterEngine) Shutdown() Result
Shutdown stops the Flutter engine.
type PlatformMessage ¶
type PlatformMessage struct { Channel string Message []byte // ResponseHandle is only set when receiving a platform message. // https://github.com/flutter/flutter/issues/18852 ResponseHandle PlatformMessageResponseHandle }
PlatformMessage represents a binary message sent from or to the flutter application.
func (PlatformMessage) ExpectsResponse ¶ added in v0.11.0
func (p PlatformMessage) ExpectsResponse() bool
ExpectsResponse indicates whether the platform message should receive a response.
type PlatformMessageResponseHandle ¶
type PlatformMessageResponseHandle uintptr
PlatformMessageResponseHandle is a pointer that is used to wire a platform message response to the original platform message.
type PointerEvent ¶
type PointerEvent struct { Phase PointerPhase Timestamp int64 X float64 Y float64 SignalKind PointerSignalKind ScrollDeltaX float64 ScrollDeltaY float64 }
PointerEvent represents the position and phase of the mouse at a given time.
type PointerPhase ¶
type PointerPhase int32
PointerPhase corresponds to the C.enum describing phase of the mouse pointer.
const ( PointerPhaseCancel PointerPhase = C.kCancel PointerPhaseUp PointerPhase = C.kUp PointerPhaseDown PointerPhase = C.kDown PointerPhaseMove PointerPhase = C.kMove PointerPhaseAdd PointerPhase = C.kAdd PointerPhaseRemove PointerPhase = C.kRemove PointerPhaseHover PointerPhase = C.kHover )
Values representing the mouse phase.
type PointerSignalKind ¶ added in v0.16.0
type PointerSignalKind int32
PointerSignalKind corresponds to the C.enum describing signal kind of the mouse pointer.
const ( PointerSignalKindNone PointerSignalKind = C.kFlutterPointerSignalKindNone PointerSignalKindScroll PointerSignalKind = C.kFlutterPointerSignalKindScroll )
Values representing the pointer signal kind.
type Result ¶
type Result int32
Result corresponds to the C.enum retuned by the shared flutter library whenever we call it.
const ( ResultSuccess Result = C.kSuccess ResultInvalidLibraryVersion Result = C.kInvalidLibraryVersion ResultInvalidArguments Result = C.kInvalidArguments )
Values representing the status of an Result.
type WindowMetricsEvent ¶
WindowMetricsEvent represents a window's resolution.