Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
embedder.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  FlutterTransformation
 
struct  FlutterOpenGLTexture
 
struct  FlutterOpenGLFramebuffer
 
struct  FlutterSize
 A structure to represent the width and height. More...
 
struct  FlutterUIntSize
 
struct  FlutterRect
 A structure to represent a rectangle. More...
 
struct  FlutterPoint
 A structure to represent a 2D point. More...
 
struct  FlutterRoundedRect
 A structure to represent a rounded rectangle. More...
 
struct  FlutterDamage
 A structure to represent a damage region. More...
 
struct  FlutterFrameInfo
 
struct  FlutterPresentInfo
 
struct  FlutterOpenGLRendererConfig
 
struct  FlutterMetalExternalTexture
 
struct  FlutterMetalTexture
 
struct  FlutterMetalRendererConfig
 
struct  FlutterVulkanImage
 
struct  FlutterVulkanRendererConfig
 
struct  FlutterSoftwareRendererConfig
 
struct  FlutterRendererConfig
 
struct  FlutterWindowMetricsEvent
 
struct  FlutterAddViewResult
 
struct  FlutterAddViewInfo
 
struct  FlutterRemoveViewResult
 
struct  FlutterRemoveViewInfo
 
struct  FlutterPointerEvent
 
struct  FlutterKeyEvent
 
struct  FlutterPlatformMessage
 
struct  FlutterSpellOutStringAttribute
 
struct  FlutterLocaleStringAttribute
 
struct  FlutterStringAttribute
 
struct  FlutterSemanticsNode
 
struct  FlutterSemanticsNode2
 
struct  FlutterSemanticsCustomAction
 
struct  FlutterSemanticsCustomAction2
 
struct  FlutterSemanticsUpdate
 
struct  FlutterSemanticsUpdate2
 A batch of updates to semantics nodes and custom actions. More...
 
struct  FlutterChannelUpdate
 An update to whether a message channel has a listener set or not. More...
 
struct  FlutterTask
 
struct  FlutterTaskRunnerDescription
 
struct  FlutterCustomTaskRunners
 
struct  FlutterOpenGLBackingStore
 
struct  FlutterSoftwareBackingStore
 
struct  FlutterSoftwareBackingStore2
 
struct  FlutterMetalBackingStore
 
struct  FlutterVulkanBackingStore
 
struct  FlutterPlatformViewMutation
 
struct  FlutterPlatformView
 
struct  FlutterBackingStore
 
struct  FlutterBackingStoreConfig
 
struct  FlutterRegion
 A region represented by a collection of non-overlapping rectangles. More...
 
struct  FlutterBackingStorePresentInfo
 
struct  FlutterLayer
 
struct  FlutterPresentViewInfo
 
struct  FlutterCompositor
 
struct  FlutterLocale
 
struct  FlutterEngineDisplay
 
struct  FlutterEngineDartBuffer
 
struct  FlutterEngineDartObject
 
struct  FlutterEngineAOTDataSource
 
struct  FlutterProjectArgs
 
struct  FlutterEngineProcTable
 Function-pointer-based versions of the APIs above. More...
 

Macros

#define FLUTTER_EXPORT
 
#define FLUTTER_API_SYMBOL(symbol)   symbol
 
#define FLUTTER_ENGINE_VERSION   1
 

Typedefs

typedef struct _FlutterEngineFLUTTER_API_SYMBOL(FlutterEngine)
 
typedef int64_t FlutterViewId
 
typedef void(* VoidCallback) (void *)
 
typedef bool(* BoolCallback) (void *)
 
typedef FlutterTransformation(* TransformationCallback) (void *)
 
typedef uint32_t(* UIntCallback) (void *)
 
typedef bool(* SoftwareSurfacePresentCallback) (void *, const void *, size_t, size_t)
 
typedef void *(* ProcResolver) (void *, const char *)
 
typedef bool(* TextureFrameCallback) (void *, int64_t, size_t, size_t, FlutterOpenGLTexture *)
 
typedef void(* VsyncCallback) (void *, intptr_t)
 
typedef void(* OnPreEngineRestartCallback) (void *)
 
typedef uint32_t(* UIntFrameInfoCallback) (void *, const FlutterFrameInfo *)
 Callback for when a frame buffer object is requested.
 
typedef void(* FlutterFrameBufferWithDamageCallback) (void *, const intptr_t, FlutterDamage *)
 
typedef bool(* BoolPresentInfoCallback) (void *, const FlutterPresentInfo *)
 Callback for when a surface is presented.
 
typedef const void * FlutterMetalDeviceHandle
 Alias for id<MTLDevice>.
 
typedef const void * FlutterMetalCommandQueueHandle
 Alias for id<MTLCommandQueue>.
 
typedef const void * FlutterMetalTextureHandle
 Alias for id<MTLTexture>.
 
typedef bool(* FlutterMetalTextureFrameCallback) (void *, int64_t, size_t, size_t, FlutterMetalExternalTexture *)
 
typedef FlutterMetalTexture(* FlutterMetalTextureCallback) (void *, const FlutterFrameInfo *)
 Callback for when a metal texture is requested.
 
typedef bool(* FlutterMetalPresentCallback) (void *, const FlutterMetalTexture *)
 
typedef void * FlutterVulkanInstanceHandle
 Alias for VkInstance.
 
typedef void * FlutterVulkanPhysicalDeviceHandle
 Alias for VkPhysicalDevice.
 
typedef void * FlutterVulkanDeviceHandle
 Alias for VkDevice.
 
typedef void * FlutterVulkanQueueHandle
 Alias for VkQueue.
 
typedef uint64_t FlutterVulkanImageHandle
 Alias for VkImage.
 
typedef void *(* FlutterVulkanInstanceProcAddressCallback) (void *, FlutterVulkanInstanceHandle, const char *)
 
typedef FlutterVulkanImage(* FlutterVulkanImageCallback) (void *, const FlutterFrameInfo *)
 Callback for when a VkImage is requested.
 
typedef bool(* FlutterVulkanPresentCallback) (void *, const FlutterVulkanImage *)
 
typedef uint64_t FlutterEngineDisplayId
 
typedef void(* FlutterAddViewCallback) (const FlutterAddViewResult *result)
 
typedef void(* FlutterRemoveViewCallback) (const FlutterRemoveViewResult *)
 
typedef void(* FlutterKeyEventCallback) (bool, void *)
 
typedef struct _FlutterPlatformMessageResponseHandle FlutterPlatformMessageResponseHandle
 
typedef void(* FlutterPlatformMessageCallback) (const FlutterPlatformMessage *, void *)
 
typedef void(* FlutterDataCallback) (const uint8_t *, size_t, void *)
 
typedef int64_t FlutterPlatformViewIdentifier
 
typedef void(* FlutterUpdateSemanticsNodeCallback) (const FlutterSemanticsNode *, void *)
 
typedef void(* FlutterUpdateSemanticsCustomActionCallback) (const FlutterSemanticsCustomAction *, void *)
 
typedef void(* FlutterUpdateSemanticsCallback) (const FlutterSemanticsUpdate *, void *)
 
typedef void(* FlutterUpdateSemanticsCallback2) (const FlutterSemanticsUpdate2 *, void *)
 
typedef void(* FlutterChannelUpdateCallback) (const FlutterChannelUpdate *, void *)
 
typedef struct _FlutterTaskRunnerFlutterTaskRunner
 
typedef void(* FlutterTaskRunnerPostTaskCallback) (FlutterTask, uint64_t, void *)
 
typedef bool(* FlutterBackingStoreCreateCallback) (const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out, void *user_data)
 
typedef bool(* FlutterBackingStoreCollectCallback) (const FlutterBackingStore *renderer, void *user_data)
 
typedef bool(* FlutterLayersPresentCallback) (const FlutterLayer **layers, size_t layers_count, void *user_data)
 
typedef bool(* FlutterPresentViewCallback) (const FlutterPresentViewInfo *)
 
typedef const FlutterLocale *(* FlutterComputePlatformResolvedLocaleCallback) (const FlutterLocale **, size_t)
 
typedef int64_t FlutterEngineDartPort
 
typedef void(* FlutterNativeThreadCallback) (FlutterNativeThreadType type, void *user_data)
 
typedef void(* FlutterLogMessageCallback) (const char *, const char *, void *)
 
typedef struct _FlutterEngineAOTDataFlutterEngineAOTData
 
typedef FlutterEngineResult(* FlutterEngineCreateAOTDataFnPtr) (const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)
 
typedef FlutterEngineResult(* FlutterEngineCollectAOTDataFnPtr) (FlutterEngineAOTData data)
 
typedef FlutterEngineResult(* FlutterEngineRunFnPtr) (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
 
typedef FlutterEngineResult(* FlutterEngineShutdownFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef FlutterEngineResult(* FlutterEngineInitializeFnPtr) (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
 
typedef FlutterEngineResult(* FlutterEngineDeinitializeFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef FlutterEngineResult(* FlutterEngineRunInitializedFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef FlutterEngineResult(* FlutterEngineSendWindowMetricsEventFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *event)
 
typedef FlutterEngineResult(* FlutterEngineSendPointerEventFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *events, size_t events_count)
 
typedef FlutterEngineResult(* FlutterEngineSendKeyEventFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
 
typedef FlutterEngineResult(* FlutterEngineSendPlatformMessageFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessage *message)
 
typedef FlutterEngineResult(* FlutterEnginePlatformMessageCreateResponseHandleFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterDataCallback data_callback, void *user_data, FlutterPlatformMessageResponseHandle **response_out)
 
typedef FlutterEngineResult(* FlutterEnginePlatformMessageReleaseResponseHandleFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterPlatformMessageResponseHandle *response)
 
typedef FlutterEngineResult(* FlutterEngineSendPlatformMessageResponseFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
 
typedef FlutterEngineResult(* FlutterEngineRegisterExternalTextureFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 
typedef FlutterEngineResult(* FlutterEngineUnregisterExternalTextureFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 
typedef FlutterEngineResult(* FlutterEngineMarkExternalTextureFrameAvailableFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 
typedef FlutterEngineResult(* FlutterEngineUpdateSemanticsEnabledFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, bool enabled)
 
typedef FlutterEngineResult(* FlutterEngineUpdateAccessibilityFeaturesFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterAccessibilityFeature features)
 
typedef FlutterEngineResult(* FlutterEngineDispatchSemanticsActionFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, uint64_t id, FlutterSemanticsAction action, const uint8_t *data, size_t data_length)
 
typedef FlutterEngineResult(* FlutterEngineOnVsyncFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, intptr_t baton, uint64_t frame_start_time_nanos, uint64_t frame_target_time_nanos)
 
typedef FlutterEngineResult(* FlutterEngineReloadSystemFontsFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef void(* FlutterEngineTraceEventDurationBeginFnPtr) (const char *name)
 
typedef void(* FlutterEngineTraceEventDurationEndFnPtr) (const char *name)
 
typedef void(* FlutterEngineTraceEventInstantFnPtr) (const char *name)
 
typedef FlutterEngineResult(* FlutterEnginePostRenderThreadTaskFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *callback_data)
 
typedef uint64_t(* FlutterEngineGetCurrentTimeFnPtr) ()
 
typedef FlutterEngineResult(* FlutterEngineRunTaskFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)
 
typedef FlutterEngineResult(* FlutterEngineUpdateLocalesFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterLocale **locales, size_t locales_count)
 
typedef bool(* FlutterEngineRunsAOTCompiledDartCodeFnPtr) (void)
 
typedef FlutterEngineResult(* FlutterEnginePostDartObjectFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDartPort port, const FlutterEngineDartObject *object)
 
typedef FlutterEngineResult(* FlutterEngineNotifyLowMemoryWarningFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef FlutterEngineResult(* FlutterEnginePostCallbackOnAllNativeThreadsFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterNativeThreadCallback callback, void *user_data)
 
typedef FlutterEngineResult(* FlutterEngineNotifyDisplayUpdateFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDisplaysUpdateType update_type, const FlutterEngineDisplay *displays, size_t display_count)
 
typedef FlutterEngineResult(* FlutterEngineScheduleFrameFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 
typedef FlutterEngineResult(* FlutterEngineSetNextFrameCallbackFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *user_data)
 
typedef FlutterEngineResult(* FlutterEngineAddViewFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterAddViewInfo *info)
 
typedef FlutterEngineResult(* FlutterEngineRemoveViewFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterRemoveViewInfo *info)
 

Enumerations

enum  FlutterEngineResult { kSuccess = 0 , kInvalidLibraryVersion , kInvalidArguments , kInternalInconsistency }
 
enum  FlutterRendererType { kOpenGL , kSoftware , kMetal , kVulkan }
 
enum  FlutterAccessibilityFeature {
  kFlutterAccessibilityFeatureAccessibleNavigation = 1 << 0 , kFlutterAccessibilityFeatureInvertColors = 1 << 1 , kFlutterAccessibilityFeatureDisableAnimations = 1 << 2 , kFlutterAccessibilityFeatureBoldText = 1 << 3 ,
  kFlutterAccessibilityFeatureReduceMotion = 1 << 4 , kFlutterAccessibilityFeatureHighContrast = 1 << 5 , kFlutterAccessibilityFeatureOnOffSwitchLabels = 1 << 6
}
 
enum  FlutterSemanticsAction {
  kFlutterSemanticsActionTap = 1 << 0 , kFlutterSemanticsActionLongPress = 1 << 1 , kFlutterSemanticsActionScrollLeft = 1 << 2 , kFlutterSemanticsActionScrollRight = 1 << 3 ,
  kFlutterSemanticsActionScrollUp = 1 << 4 , kFlutterSemanticsActionScrollDown = 1 << 5 , kFlutterSemanticsActionIncrease = 1 << 6 , kFlutterSemanticsActionDecrease = 1 << 7 ,
  kFlutterSemanticsActionShowOnScreen = 1 << 8 , kFlutterSemanticsActionMoveCursorForwardByCharacter = 1 << 9 , kFlutterSemanticsActionMoveCursorBackwardByCharacter = 1 << 10 , kFlutterSemanticsActionSetSelection = 1 << 11 ,
  kFlutterSemanticsActionCopy = 1 << 12 , kFlutterSemanticsActionCut = 1 << 13 , kFlutterSemanticsActionPaste = 1 << 14 , kFlutterSemanticsActionDidGainAccessibilityFocus = 1 << 15 ,
  kFlutterSemanticsActionDidLoseAccessibilityFocus = 1 << 16 , kFlutterSemanticsActionCustomAction = 1 << 17 , kFlutterSemanticsActionDismiss = 1 << 18 , kFlutterSemanticsActionMoveCursorForwardByWord = 1 << 19 ,
  kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20 , kFlutterSemanticsActionSetText = 1 << 21
}
 
enum  FlutterSemanticsFlag {
  kFlutterSemanticsFlagHasCheckedState = 1 << 0 , kFlutterSemanticsFlagIsChecked = 1 << 1 , kFlutterSemanticsFlagIsSelected = 1 << 2 , kFlutterSemanticsFlagIsButton = 1 << 3 ,
  kFlutterSemanticsFlagIsTextField = 1 << 4 , kFlutterSemanticsFlagIsFocused = 1 << 5 , kFlutterSemanticsFlagHasEnabledState = 1 << 6 , kFlutterSemanticsFlagIsEnabled = 1 << 7 ,
  kFlutterSemanticsFlagIsInMutuallyExclusiveGroup = 1 << 8 , kFlutterSemanticsFlagIsHeader = 1 << 9 , kFlutterSemanticsFlagIsObscured = 1 << 10 , kFlutterSemanticsFlagScopesRoute = 1 << 11 ,
  kFlutterSemanticsFlagNamesRoute = 1 << 12 , kFlutterSemanticsFlagIsHidden = 1 << 13 , kFlutterSemanticsFlagIsImage = 1 << 14 , kFlutterSemanticsFlagIsLiveRegion = 1 << 15 ,
  kFlutterSemanticsFlagHasToggledState = 1 << 16 , kFlutterSemanticsFlagIsToggled = 1 << 17 , kFlutterSemanticsFlagHasImplicitScrolling = 1 << 18 , kFlutterSemanticsFlagIsMultiline = 1 << 19 ,
  kFlutterSemanticsFlagIsReadOnly = 1 << 20 , kFlutterSemanticsFlagIsFocusable = 1 << 21 , kFlutterSemanticsFlagIsLink = 1 << 22 , kFlutterSemanticsFlagIsSlider = 1 << 23 ,
  kFlutterSemanticsFlagIsKeyboardKey = 1 << 24 , kFlutterSemanticsFlagIsCheckStateMixed = 1 << 25 , kFlutterSemanticsFlagHasExpandedState = 1 << 26 , kFlutterSemanticsFlagIsExpanded = 1 << 27
}
 
enum  FlutterTextDirection { kFlutterTextDirectionUnknown = 0 , kFlutterTextDirectionRTL = 1 , kFlutterTextDirectionLTR = 2 }
 
enum  FlutterThreadPriority { kBackground = 0 , kNormal = 1 , kDisplay = 2 , kRaster = 3 }
 Valid values for priority of Thread. More...
 
enum  FlutterOpenGLTargetType { kFlutterOpenGLTargetTypeTexture , kFlutterOpenGLTargetTypeFramebuffer }
 
enum  FlutterSoftwarePixelFormat {
  kFlutterSoftwarePixelFormatGray8 , kFlutterSoftwarePixelFormatRGB565 , kFlutterSoftwarePixelFormatRGBA4444 , kFlutterSoftwarePixelFormatRGBA8888 ,
  kFlutterSoftwarePixelFormatRGBX8888 , kFlutterSoftwarePixelFormatBGRA8888 , kFlutterSoftwarePixelFormatNative32
}
 
enum  FlutterMetalExternalTexturePixelFormat { kYUVA , kRGBA }
 Pixel format for the external texture. More...
 
enum  FlutterMetalExternalTextureYUVColorSpace { kBT601FullRange , kBT601LimitedRange }
 YUV color space for the YUV external texture. More...
 
enum  FlutterPointerPhase {
  kCancel , kUp , kDown , kMove ,
  kAdd , kRemove , kHover , kPanZoomStart ,
  kPanZoomUpdate , kPanZoomEnd
}
 The phase of the pointer event. More...
 
enum  FlutterPointerDeviceKind { kFlutterPointerDeviceKindMouse = 1 , kFlutterPointerDeviceKindTouch , kFlutterPointerDeviceKindStylus , kFlutterPointerDeviceKindTrackpad }
 The device type that created a pointer event. More...
 
enum  FlutterPointerMouseButtons {
  kFlutterPointerButtonMousePrimary = 1 << 0 , kFlutterPointerButtonMouseSecondary = 1 << 1 , kFlutterPointerButtonMouseMiddle = 1 << 2 , kFlutterPointerButtonMouseBack = 1 << 3 ,
  kFlutterPointerButtonMouseForward = 1 << 4
}
 
enum  FlutterPointerSignalKind { kFlutterPointerSignalKindNone , kFlutterPointerSignalKindScroll , kFlutterPointerSignalKindScrollInertiaCancel , kFlutterPointerSignalKindScale }
 The type of a pointer signal. More...
 
enum  FlutterKeyEventType { kFlutterKeyEventTypeUp = 1 , kFlutterKeyEventTypeDown , kFlutterKeyEventTypeRepeat }
 
enum  FlutterKeyEventDeviceType {
  kFlutterKeyEventDeviceTypeKeyboard = 1 , kFlutterKeyEventDeviceTypeDirectionalPad , kFlutterKeyEventDeviceTypeGamepad , kFlutterKeyEventDeviceTypeJoystick ,
  kFlutterKeyEventDeviceTypeHdmi
}
 
enum  FlutterStringAttributeType { kSpellOut , kLocale }
 
enum  FlutterPlatformViewMutationType { kFlutterPlatformViewMutationTypeOpacity , kFlutterPlatformViewMutationTypeClipRect , kFlutterPlatformViewMutationTypeClipRoundedRect , kFlutterPlatformViewMutationTypeTransformation }
 
enum  FlutterBackingStoreType {
  kFlutterBackingStoreTypeOpenGL , kFlutterBackingStoreTypeSoftware , kFlutterBackingStoreTypeMetal , kFlutterBackingStoreTypeVulkan ,
  kFlutterBackingStoreTypeSoftware2
}
 
enum  FlutterLayerContentType { kFlutterLayerContentTypeBackingStore , kFlutterLayerContentTypePlatformView }
 
enum  FlutterEngineDisplaysUpdateType { kFlutterEngineDisplaysUpdateTypeStartup , kFlutterEngineDisplaysUpdateTypeCount }
 
enum  FlutterEngineDartObjectType {
  kFlutterEngineDartObjectTypeNull , kFlutterEngineDartObjectTypeBool , kFlutterEngineDartObjectTypeInt32 , kFlutterEngineDartObjectTypeInt64 ,
  kFlutterEngineDartObjectTypeDouble , kFlutterEngineDartObjectTypeString , kFlutterEngineDartObjectTypeBuffer
}
 
enum  FlutterNativeThreadType { kFlutterNativeThreadTypePlatform , kFlutterNativeThreadTypeRender , kFlutterNativeThreadTypeUI , kFlutterNativeThreadTypeWorker }
 
enum  FlutterEngineAOTDataSourceType { kFlutterEngineAOTDataSourceTypeElfPath }
 AOT data source type. More...
 

Functions

FLUTTER_EXPORT FlutterEngineResult FlutterEngineCreateAOTData (const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)
 Creates the necessary data structures to launch a Flutter Dart application in AOT mode. The data may only be collected after all FlutterEngine instances launched using this data have been terminated.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineCollectAOTData (FlutterEngineAOTData data)
 Collects the AOT data.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRun (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
 Initialize and run a Flutter engine instance and return a handle to it. This is a convenience method for the pair of calls to FlutterEngineInitialize and FlutterEngineRunInitialized.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineShutdown (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embedder API after this point. Making additional calls with this handle is undefined behavior.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineInitialize (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
 Initialize a Flutter engine instance. This does not run the Flutter application code till the FlutterEngineRunInitialized call is made. Besides Flutter application code, no tasks are scheduled on embedder managed task runners either. This allows embedders providing custom task runners to the Flutter engine to obtain a handle to the Flutter engine before the engine can post tasks on these task runners.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineDeinitialize (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Stops running the Flutter engine instance. After this call, the embedder is also guaranteed that no more calls to post tasks onto custom task runners specified by the embedder are made. The Flutter engine handle still needs to be collected via a call to FlutterEngineShutdown.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRunInitialized (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Runs an initialized engine instance. An engine can be initialized via FlutterEngineInitialize. An initialized instance can only be run once. During and after this call, custom task runners supplied by the embedder are expected to start servicing tasks.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineAddView (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterAddViewInfo *info)
 Adds a view.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRemoveView (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterRemoveViewInfo *info)
 Removes a view.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendWindowMetricsEvent (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *event)
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPointerEvent (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *events, size_t events_count)
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendKeyEvent (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
 Sends a key event to the engine. The framework will decide whether to handle this event in a synchronous fashion, although due to technical limitation, the result is always reported asynchronously. The callback is guaranteed to be called exactly once.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPlatformMessage (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessage *message)
 
FLUTTER_EXPORT FlutterEngineResult FlutterPlatformMessageCreateResponseHandle (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterDataCallback data_callback, void *user_data, FlutterPlatformMessageResponseHandle **response_out)
 Creates a platform message response handle that allows the embedder to set a native callback for a response to a message. This handle may be set on the response_handle field of any FlutterPlatformMessage sent to the engine.
 
FLUTTER_EXPORT FlutterEngineResult FlutterPlatformMessageReleaseResponseHandle (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterPlatformMessageResponseHandle *response)
 Collects the handle created using FlutterPlatformMessageCreateResponseHandle.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPlatformMessageResponse (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
 Send a response from the native side to a platform message from the Dart Flutter application.
 
FLUTTER_EXPORT FlutterEngineResult __FlutterEngineFlushPendingTasksNow ()
 This API is only meant to be used by platforms that need to flush tasks on a message loop not controlled by the Flutter engine.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRegisterExternalTexture (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 Register an external texture with a unique (per engine) identifier. Only rendering backends that support external textures accept external texture registrations. After the external texture is registered, the application can mark that a frame is available by calling FlutterEngineMarkExternalTextureFrameAvailable.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineUnregisterExternalTexture (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 Unregister a previous texture registration.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
 Mark that a new texture frame is available for a given texture identifier.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateSemanticsEnabled (FLUTTER_API_SYMBOL(FlutterEngine) engine, bool enabled)
 Enable or disable accessibility semantics.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterAccessibilityFeature features)
 Sets additional accessibility features.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineDispatchSemanticsAction (FLUTTER_API_SYMBOL(FlutterEngine) engine, uint64_t node_id, FlutterSemanticsAction action, const uint8_t *data, size_t data_length)
 Dispatch a semantics action to the specified semantics node.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync (FLUTTER_API_SYMBOL(FlutterEngine) engine, intptr_t baton, uint64_t frame_start_time_nanos, uint64_t frame_target_time_nanos)
 Notify the engine that a vsync event occurred. A baton passed to the platform via the vsync callback must be returned. This call must be made on the thread on which the call to FlutterEngineRun was made.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineReloadSystemFonts (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Reloads the system fonts in engine.
 
FLUTTER_EXPORT void FlutterEngineTraceEventDurationBegin (const char *name)
 A profiling utility. Logs a trace duration begin event to the timeline. If the timeline is unavailable or disabled, this has no effect. Must be balanced with an duration end event (via FlutterEngineTraceEventDurationEnd) with the same name on the same thread. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.
 
FLUTTER_EXPORT void FlutterEngineTraceEventDurationEnd (const char *name)
 A profiling utility. Logs a trace duration end event to the timeline. If the timeline is unavailable or disabled, this has no effect. This call must be preceded by a trace duration begin call (via FlutterEngineTraceEventDurationBegin) with the same name on the same thread. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.
 
FLUTTER_EXPORT void FlutterEngineTraceEventInstant (const char *name)
 A profiling utility. Logs a trace duration instant event to the timeline. If the timeline is unavailable or disabled, this has no effect. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostRenderThreadTask (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *callback_data)
 Posts a task onto the Flutter render thread. Typically, this may be called from any thread as long as a FlutterEngineShutdown on the specific engine has not already been initiated.
 
FLUTTER_EXPORT uint64_t FlutterEngineGetCurrentTime ()
 Get the current time in nanoseconds from the clock used by the flutter engine. This is the system monotonic clock.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRunTask (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)
 Inform the engine to run the specified task. This task has been given to the engine via the FlutterTaskRunnerDescription.post_task_callback. This call must only be made at the target time specified in that callback. Running the task before that time is undefined behavior.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateLocales (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterLocale **locales, size_t locales_count)
 Notify a running engine instance that the locale has been updated. The preferred locale must be the first item in the list of locales supplied. The other entries will be used as a fallback.
 
FLUTTER_EXPORT bool FlutterEngineRunsAOTCompiledDartCode (void)
 Returns if the Flutter engine instance will run AOT compiled Dart code. This call has no threading restrictions.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostDartObject (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDartPort port, const FlutterEngineDartObject *object)
 Posts a Dart object to specified send port. The corresponding receive port for send port can be in any isolate running in the VM. This isolate can also be the root isolate for an unrelated engine. The engine parameter is necessary only to ensure the call is not made when no engine (and hence no VM) is running.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineNotifyLowMemoryWarning (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Posts a low memory notification to a running engine instance. The engine will do its best to release non-critical resources in response. It is not guaranteed that the resource would have been collected by the time this call returns however. The notification is posted to engine subsystems that may be operating on other threads.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostCallbackOnAllNativeThreads (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterNativeThreadCallback callback, void *user_data)
 Schedule a callback to be run on all engine managed threads. The engine will attempt to service this callback the next time the message loop for each managed thread is idle. Since the engine manages the entire lifecycle of multiple threads, there is no opportunity for the embedders to finely tune the priorities of threads directly, or, perform other thread specific configuration (for example, setting thread names for tracing). This callback gives embedders a chance to affect such tuning.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineNotifyDisplayUpdate (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDisplaysUpdateType update_type, const FlutterEngineDisplay *displays, size_t display_count)
 Posts updates corresponding to display changes to a running engine instance.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineScheduleFrame (FLUTTER_API_SYMBOL(FlutterEngine) engine)
 Schedule a new frame to redraw the content.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineSetNextFrameCallback (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *user_data)
 Schedule a callback to be called after the next frame is drawn. This must be called from the platform thread. The callback is executed only once from the raster thread; embedders must re-thread if necessary. Performing blocking calls in this callback may introduce application jank.
 
FLUTTER_EXPORT FlutterEngineResult FlutterEngineGetProcAddresses (FlutterEngineProcTable *table)
 Gets the table of engine function pointers.
 

Variables

FLUTTER_EXPORT const int32_t kFlutterSemanticsNodeIdBatchEnd
 
FLUTTER_EXPORT const int32_t kFlutterSemanticsCustomActionIdBatchEnd
 

Macro Definition Documentation

◆ FLUTTER_API_SYMBOL

#define FLUTTER_API_SYMBOL (   symbol)    symbol

Definition at line 67 of file embedder.h.

◆ FLUTTER_ENGINE_VERSION

#define FLUTTER_ENGINE_VERSION   1

Definition at line 70 of file embedder.h.

◆ FLUTTER_EXPORT

#define FLUTTER_EXPORT

Definition at line 57 of file embedder.h.

Typedef Documentation

◆ BoolCallback

typedef bool(* BoolCallback) (void *)

Definition at line 404 of file embedder.h.

◆ BoolPresentInfoCallback

typedef bool(* BoolPresentInfoCallback) (void *, const FlutterPresentInfo *)

Callback for when a surface is presented.

Definition at line 507 of file embedder.h.

◆ FLUTTER_API_SYMBOL

typedef struct _FlutterEngine * FLUTTER_API_SYMBOL(FlutterEngine)

Definition at line 267 of file embedder.h.

◆ FlutterAddViewCallback

typedef void(* FlutterAddViewCallback) (const FlutterAddViewResult *result)

The callback invoked by the engine when the engine has attempted to add a view.

The |FlutterAddViewResult| is only guaranteed to be valid during this callback.

Definition at line 883 of file embedder.h.

◆ FlutterBackingStoreCollectCallback

typedef bool(* FlutterBackingStoreCollectCallback) (const FlutterBackingStore *renderer, void *user_data)

Definition at line 1869 of file embedder.h.

◆ FlutterBackingStoreCreateCallback

typedef bool(* FlutterBackingStoreCreateCallback) (const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out, void *user_data)

Definition at line 1864 of file embedder.h.

◆ FlutterChannelUpdateCallback

typedef void(* FlutterChannelUpdateCallback) (const FlutterChannelUpdate *, void *)

Definition at line 1542 of file embedder.h.

◆ FlutterComputePlatformResolvedLocaleCallback

typedef const FlutterLocale *(* FlutterComputePlatformResolvedLocaleCallback) (const FlutterLocale **, size_t)

Callback that returns the system locale.

Embedders that implement this callback should return the FlutterLocale from the supported_locales list that most closely matches the user/device's preferred locale.

This callback does not currently provide the user_data baton. https://github.com/flutter/flutter/issues/79826

Definition at line 1965 of file embedder.h.

◆ FlutterDataCallback

typedef void(* FlutterDataCallback) (const uint8_t *, size_t, void *)

Definition at line 1179 of file embedder.h.

◆ FlutterEngineAddViewFnPtr

typedef FlutterEngineResult(* FlutterEngineAddViewFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterAddViewInfo *info)

Definition at line 3309 of file embedder.h.

◆ FlutterEngineAOTData

An opaque object that describes the AOT data that can be used to launch a FlutterEngine instance in AOT mode.

Definition at line 2134 of file embedder.h.

◆ FlutterEngineCollectAOTDataFnPtr

typedef FlutterEngineResult(* FlutterEngineCollectAOTDataFnPtr) (FlutterEngineAOTData data)

Definition at line 3193 of file embedder.h.

◆ FlutterEngineCreateAOTDataFnPtr

typedef FlutterEngineResult(* FlutterEngineCreateAOTDataFnPtr) (const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)

Definition at line 3190 of file embedder.h.

◆ FlutterEngineDartPort

typedef int64_t FlutterEngineDartPort

Definition at line 2008 of file embedder.h.

◆ FlutterEngineDeinitializeFnPtr

typedef FlutterEngineResult(* FlutterEngineDeinitializeFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3209 of file embedder.h.

◆ FlutterEngineDispatchSemanticsActionFnPtr

typedef FlutterEngineResult(* FlutterEngineDispatchSemanticsActionFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, uint64_t id, FlutterSemanticsAction action, const uint8_t *data, size_t data_length)

Definition at line 3259 of file embedder.h.

◆ FlutterEngineDisplayId

typedef uint64_t FlutterEngineDisplayId

Display refers to a graphics hardware system consisting of a framebuffer, typically a monitor or a screen. This ID is unique per display and is stable until the Flutter application restarts.

Definition at line 837 of file embedder.h.

◆ FlutterEngineGetCurrentTimeFnPtr

typedef uint64_t(* FlutterEngineGetCurrentTimeFnPtr) ()

Definition at line 3279 of file embedder.h.

◆ FlutterEngineInitializeFnPtr

typedef FlutterEngineResult(* FlutterEngineInitializeFnPtr) (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)

Definition at line 3203 of file embedder.h.

◆ FlutterEngineMarkExternalTextureFrameAvailableFnPtr

typedef FlutterEngineResult( * FlutterEngineMarkExternalTextureFrameAvailableFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)

Definition at line 3249 of file embedder.h.

◆ FlutterEngineNotifyDisplayUpdateFnPtr

typedef FlutterEngineResult(* FlutterEngineNotifyDisplayUpdateFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDisplaysUpdateType update_type, const FlutterEngineDisplay *displays, size_t display_count)

Definition at line 3298 of file embedder.h.

◆ FlutterEngineNotifyLowMemoryWarningFnPtr

typedef FlutterEngineResult(* FlutterEngineNotifyLowMemoryWarningFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3292 of file embedder.h.

◆ FlutterEngineOnVsyncFnPtr

typedef FlutterEngineResult(* FlutterEngineOnVsyncFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, intptr_t baton, uint64_t frame_start_time_nanos, uint64_t frame_target_time_nanos)

Definition at line 3265 of file embedder.h.

◆ FlutterEnginePlatformMessageCreateResponseHandleFnPtr

typedef FlutterEngineResult( * FlutterEnginePlatformMessageCreateResponseHandleFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterDataCallback data_callback, void *user_data, FlutterPlatformMessageResponseHandle **response_out)

Definition at line 3228 of file embedder.h.

◆ FlutterEnginePlatformMessageReleaseResponseHandleFnPtr

typedef FlutterEngineResult( * FlutterEnginePlatformMessageReleaseResponseHandleFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterPlatformMessageResponseHandle *response)

Definition at line 3234 of file embedder.h.

◆ FlutterEnginePostCallbackOnAllNativeThreadsFnPtr

typedef FlutterEngineResult(* FlutterEnginePostCallbackOnAllNativeThreadsFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterNativeThreadCallback callback, void *user_data)

Definition at line 3294 of file embedder.h.

◆ FlutterEnginePostDartObjectFnPtr

typedef FlutterEngineResult(* FlutterEnginePostDartObjectFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDartPort port, const FlutterEngineDartObject *object)

Definition at line 3288 of file embedder.h.

◆ FlutterEnginePostRenderThreadTaskFnPtr

typedef FlutterEngineResult(* FlutterEnginePostRenderThreadTaskFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *callback_data)

Definition at line 3275 of file embedder.h.

◆ FlutterEngineRegisterExternalTextureFnPtr

typedef FlutterEngineResult(* FlutterEngineRegisterExternalTextureFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)

Definition at line 3243 of file embedder.h.

◆ FlutterEngineReloadSystemFontsFnPtr

typedef FlutterEngineResult(* FlutterEngineReloadSystemFontsFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3270 of file embedder.h.

◆ FlutterEngineRemoveViewFnPtr

typedef FlutterEngineResult(* FlutterEngineRemoveViewFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterRemoveViewInfo *info)

Definition at line 3312 of file embedder.h.

◆ FlutterEngineRunFnPtr

typedef FlutterEngineResult(* FlutterEngineRunFnPtr) (size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)

Definition at line 3195 of file embedder.h.

◆ FlutterEngineRunInitializedFnPtr

typedef FlutterEngineResult(* FlutterEngineRunInitializedFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3211 of file embedder.h.

◆ FlutterEngineRunsAOTCompiledDartCodeFnPtr

typedef bool(* FlutterEngineRunsAOTCompiledDartCodeFnPtr) (void)

Definition at line 3287 of file embedder.h.

◆ FlutterEngineRunTaskFnPtr

typedef FlutterEngineResult(* FlutterEngineRunTaskFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)

Definition at line 3280 of file embedder.h.

◆ FlutterEngineScheduleFrameFnPtr

typedef FlutterEngineResult(* FlutterEngineScheduleFrameFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3303 of file embedder.h.

◆ FlutterEngineSendKeyEventFnPtr

Definition at line 3220 of file embedder.h.

◆ FlutterEngineSendPlatformMessageFnPtr

typedef FlutterEngineResult(* FlutterEngineSendPlatformMessageFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessage *message)

Definition at line 3225 of file embedder.h.

◆ FlutterEngineSendPlatformMessageResponseFnPtr

typedef FlutterEngineResult(* FlutterEngineSendPlatformMessageResponseFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessageResponseHandle *handle, const uint8_t *data, size_t data_length)

Definition at line 3238 of file embedder.h.

◆ FlutterEngineSendPointerEventFnPtr

typedef FlutterEngineResult(* FlutterEngineSendPointerEventFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *events, size_t events_count)

Definition at line 3216 of file embedder.h.

◆ FlutterEngineSendWindowMetricsEventFnPtr

typedef FlutterEngineResult(* FlutterEngineSendWindowMetricsEventFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *event)

Definition at line 3213 of file embedder.h.

◆ FlutterEngineSetNextFrameCallbackFnPtr

typedef FlutterEngineResult(* FlutterEngineSetNextFrameCallbackFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *user_data)

Definition at line 3305 of file embedder.h.

◆ FlutterEngineShutdownFnPtr

typedef FlutterEngineResult(* FlutterEngineShutdownFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine)

Definition at line 3201 of file embedder.h.

◆ FlutterEngineTraceEventDurationBeginFnPtr

typedef void(* FlutterEngineTraceEventDurationBeginFnPtr) (const char *name)

Definition at line 3272 of file embedder.h.

◆ FlutterEngineTraceEventDurationEndFnPtr

typedef void(* FlutterEngineTraceEventDurationEndFnPtr) (const char *name)

Definition at line 3273 of file embedder.h.

◆ FlutterEngineTraceEventInstantFnPtr

typedef void(* FlutterEngineTraceEventInstantFnPtr) (const char *name)

Definition at line 3274 of file embedder.h.

◆ FlutterEngineUnregisterExternalTextureFnPtr

typedef FlutterEngineResult(* FlutterEngineUnregisterExternalTextureFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)

Definition at line 3246 of file embedder.h.

◆ FlutterEngineUpdateAccessibilityFeaturesFnPtr

typedef FlutterEngineResult(* FlutterEngineUpdateAccessibilityFeaturesFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterAccessibilityFeature features)

Definition at line 3256 of file embedder.h.

◆ FlutterEngineUpdateLocalesFnPtr

typedef FlutterEngineResult(* FlutterEngineUpdateLocalesFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterLocale **locales, size_t locales_count)

Definition at line 3283 of file embedder.h.

◆ FlutterEngineUpdateSemanticsEnabledFnPtr

typedef FlutterEngineResult(* FlutterEngineUpdateSemanticsEnabledFnPtr) (FLUTTER_API_SYMBOL(FlutterEngine) engine, bool enabled)

Definition at line 3253 of file embedder.h.

◆ FlutterFrameBufferWithDamageCallback

typedef void(* FlutterFrameBufferWithDamageCallback) (void *, const intptr_t, FlutterDamage *)

Callback for when a frame buffer object is requested with necessary information for partial repaint.

Definition at line 487 of file embedder.h.

◆ FlutterKeyEventCallback

typedef void(* FlutterKeyEventCallback) (bool, void *)

Definition at line 1153 of file embedder.h.

◆ FlutterLayersPresentCallback

typedef bool(* FlutterLayersPresentCallback) (const FlutterLayer **layers, size_t layers_count, void *user_data)

Definition at line 1873 of file embedder.h.

◆ FlutterLogMessageCallback

typedef void(* FlutterLogMessageCallback) (const char *, const char *, void *)

Definition at line 2128 of file embedder.h.

◆ FlutterMetalCommandQueueHandle

typedef const void* FlutterMetalCommandQueueHandle

Alias for id<MTLCommandQueue>.

Definition at line 597 of file embedder.h.

◆ FlutterMetalDeviceHandle

typedef const void* FlutterMetalDeviceHandle

Alias for id<MTLDevice>.

Definition at line 594 of file embedder.h.

◆ FlutterMetalPresentCallback

typedef bool(* FlutterMetalPresentCallback) (void *, const FlutterMetalTexture *)

Callback for when a metal texture is presented. The texture_id here corresponds to the texture_id provided by the embedder in the FlutterMetalTextureCallback callback.

Definition at line 677 of file embedder.h.

◆ FlutterMetalTextureCallback

typedef FlutterMetalTexture(* FlutterMetalTextureCallback) (void *, const FlutterFrameInfo *)

Callback for when a metal texture is requested.

Definition at line 670 of file embedder.h.

◆ FlutterMetalTextureFrameCallback

typedef bool(* FlutterMetalTextureFrameCallback) (void *, int64_t, size_t, size_t, FlutterMetalExternalTexture *)

Callback to provide an external texture for a given texture_id. See: external_texture_frame_callback.

Definition at line 640 of file embedder.h.

◆ FlutterMetalTextureHandle

typedef const void* FlutterMetalTextureHandle

Alias for id<MTLTexture>.

Definition at line 600 of file embedder.h.

◆ FlutterNativeThreadCallback

typedef void(* FlutterNativeThreadCallback) (FlutterNativeThreadType type, void *user_data)

A callback made by the engine in response to FlutterEnginePostCallbackOnAllNativeThreads on all internal thread.

Definition at line 2103 of file embedder.h.

◆ FlutterPlatformMessageCallback

typedef void(* FlutterPlatformMessageCallback) (const FlutterPlatformMessage *, void *)

Definition at line 1175 of file embedder.h.

◆ FlutterPlatformMessageResponseHandle

Definition at line 1158 of file embedder.h.

◆ FlutterPlatformViewIdentifier

The identifier of the platform view. This identifier is specified by the application when a platform view is added to the scene via the SceneBuilder.addPlatformView call.

Definition at line 1186 of file embedder.h.

◆ FlutterPresentViewCallback

typedef bool(* FlutterPresentViewCallback) (const FlutterPresentViewInfo *)

The callback invoked when the embedder should present to a view.

The |FlutterPresentViewInfo| will be deallocated once the callback returns.

Definition at line 1880 of file embedder.h.

◆ FlutterRemoveViewCallback

typedef void(* FlutterRemoveViewCallback) (const FlutterRemoveViewResult *)

The callback invoked by the engine when the engine has attempted to remove a view.

The |FlutterRemoveViewResult| is only guaranteed to be valid during this callback.

Definition at line 931 of file embedder.h.

◆ FlutterTaskRunner

Definition at line 1546 of file embedder.h.

◆ FlutterTaskRunnerPostTaskCallback

typedef void(* FlutterTaskRunnerPostTaskCallback) (FlutterTask, uint64_t, void *)

Definition at line 1553 of file embedder.h.

◆ FlutterUpdateSemanticsCallback

typedef void(* FlutterUpdateSemanticsCallback) (const FlutterSemanticsUpdate *, void *)

Definition at line 1524 of file embedder.h.

◆ FlutterUpdateSemanticsCallback2

typedef void(* FlutterUpdateSemanticsCallback2) (const FlutterSemanticsUpdate2 *, void *)

Definition at line 1528 of file embedder.h.

◆ FlutterUpdateSemanticsCustomActionCallback

typedef void(* FlutterUpdateSemanticsCustomActionCallback) (const FlutterSemanticsCustomAction *, void *)

Definition at line 1520 of file embedder.h.

◆ FlutterUpdateSemanticsNodeCallback

typedef void(* FlutterUpdateSemanticsNodeCallback) (const FlutterSemanticsNode *, void *)

Definition at line 1516 of file embedder.h.

◆ FlutterViewId

typedef int64_t FlutterViewId

Unique identifier for views.

View IDs are generated by the embedder and are opaque to the engine; the engine does not interpret view IDs in any way.

Definition at line 273 of file embedder.h.

◆ FlutterVulkanDeviceHandle

Alias for VkDevice.

Definition at line 712 of file embedder.h.

◆ FlutterVulkanImageCallback

typedef FlutterVulkanImage(* FlutterVulkanImageCallback) (void *, const FlutterFrameInfo *)

Callback for when a VkImage is requested.

Definition at line 738 of file embedder.h.

◆ FlutterVulkanImageHandle

typedef uint64_t FlutterVulkanImageHandle

Alias for VkImage.

Definition at line 718 of file embedder.h.

◆ FlutterVulkanInstanceHandle

Alias for VkInstance.

Definition at line 706 of file embedder.h.

◆ FlutterVulkanInstanceProcAddressCallback

typedef void *(* FlutterVulkanInstanceProcAddressCallback) (void *, FlutterVulkanInstanceHandle, const char *)

Callback to fetch a Vulkan function pointer for a given instance. Normally, this should return the results of vkGetInstanceProcAddr.

Definition at line 732 of file embedder.h.

◆ FlutterVulkanPhysicalDeviceHandle

Alias for VkPhysicalDevice.

Definition at line 709 of file embedder.h.

◆ FlutterVulkanPresentCallback

typedef bool(* FlutterVulkanPresentCallback) (void *, const FlutterVulkanImage *)

Callback for when a VkImage has been written to and is ready for use by the embedder.

Definition at line 744 of file embedder.h.

◆ FlutterVulkanQueueHandle

typedef void* FlutterVulkanQueueHandle

Alias for VkQueue.

Definition at line 715 of file embedder.h.

◆ OnPreEngineRestartCallback

typedef void(* OnPreEngineRestartCallback) (void *)

Definition at line 418 of file embedder.h.

◆ ProcResolver

typedef void *(* ProcResolver) (void *, const char *)

Definition at line 411 of file embedder.h.

◆ SoftwareSurfacePresentCallback

typedef bool(* SoftwareSurfacePresentCallback) (void *, const void *, size_t, size_t)

Definition at line 407 of file embedder.h.

◆ TextureFrameCallback

typedef bool(* TextureFrameCallback) (void *, int64_t, size_t, size_t, FlutterOpenGLTexture *)

Definition at line 412 of file embedder.h.

◆ TransformationCallback

typedef FlutterTransformation(* TransformationCallback) (void *)

Definition at line 405 of file embedder.h.

◆ UIntCallback

typedef uint32_t(* UIntCallback) (void *)

Definition at line 406 of file embedder.h.

◆ UIntFrameInfoCallback

typedef uint32_t(* UIntFrameInfoCallback) (void *, const FlutterFrameInfo *)

Callback for when a frame buffer object is requested.

Definition at line 481 of file embedder.h.

◆ VoidCallback

typedef void(* VoidCallback) (void *)

Definition at line 296 of file embedder.h.

◆ VsyncCallback

typedef void(* VsyncCallback) (void *, intptr_t)

Definition at line 417 of file embedder.h.

Enumeration Type Documentation

◆ FlutterAccessibilityFeature

Additional accessibility features that may be enabled by the platform. Must match the AccessibilityFeatures enum in window.dart.

Enumerator
kFlutterAccessibilityFeatureAccessibleNavigation 

Indicate there is a running accessibility service which is changing the interaction model of the device.

kFlutterAccessibilityFeatureInvertColors 

Indicate the platform is inverting the colors of the application.

kFlutterAccessibilityFeatureDisableAnimations 

Request that animations be disabled or simplified.

kFlutterAccessibilityFeatureBoldText 

Request that text be rendered at a bold font weight.

kFlutterAccessibilityFeatureReduceMotion 

Request that certain animations be simplified and parallax effects removed.

kFlutterAccessibilityFeatureHighContrast 

Request that UI be rendered with darker colors.

kFlutterAccessibilityFeatureOnOffSwitchLabels 

Request to show on/off labels inside switches.

Definition at line 91 of file embedder.h.

91 {
92 /// Indicate there is a running accessibility service which is changing the
93 /// interaction model of the device.
95 /// Indicate the platform is inverting the colors of the application.
97 /// Request that animations be disabled or simplified.
99 /// Request that text be rendered at a bold font weight.
101 /// Request that certain animations be simplified and parallax effects
102 /// removed.
104 /// Request that UI be rendered with darker colors.
106 /// Request to show on/off labels inside switches.
FlutterAccessibilityFeature
Definition embedder.h:91
@ kFlutterAccessibilityFeatureOnOffSwitchLabels
Request to show on/off labels inside switches.
Definition embedder.h:107
@ kFlutterAccessibilityFeatureBoldText
Request that text be rendered at a bold font weight.
Definition embedder.h:100
@ kFlutterAccessibilityFeatureHighContrast
Request that UI be rendered with darker colors.
Definition embedder.h:105
@ kFlutterAccessibilityFeatureReduceMotion
Definition embedder.h:103
@ kFlutterAccessibilityFeatureDisableAnimations
Request that animations be disabled or simplified.
Definition embedder.h:98
@ kFlutterAccessibilityFeatureInvertColors
Indicate the platform is inverting the colors of the application.
Definition embedder.h:96
@ kFlutterAccessibilityFeatureAccessibleNavigation
Definition embedder.h:94

◆ FlutterBackingStoreType

Enumerator
kFlutterBackingStoreTypeOpenGL 

Specifies an OpenGL backing store. Can either be an OpenGL texture or framebuffer.

kFlutterBackingStoreTypeSoftware 

Specified an software allocation for Flutter to render into using the CPU.

kFlutterBackingStoreTypeMetal 

Specifies a Metal backing store. This is backed by a Metal texture.

kFlutterBackingStoreTypeVulkan 

Specifies a Vulkan backing store. This is backed by a Vulkan VkImage.

kFlutterBackingStoreTypeSoftware2 

Specifies a allocation that the engine should render into using software rendering.

Definition at line 1737 of file embedder.h.

1737 {
1738 /// Specifies an OpenGL backing store. Can either be an OpenGL texture or
1739 /// framebuffer.
1741 /// Specified an software allocation for Flutter to render into using the CPU.
1743 /// Specifies a Metal backing store. This is backed by a Metal texture.
1745 /// Specifies a Vulkan backing store. This is backed by a Vulkan VkImage.
1747 /// Specifies a allocation that the engine should render into using
1748 /// software rendering.
FlutterBackingStoreType
Definition embedder.h:1737
@ kFlutterBackingStoreTypeSoftware2
Definition embedder.h:1749
@ kFlutterBackingStoreTypeMetal
Specifies a Metal backing store. This is backed by a Metal texture.
Definition embedder.h:1744
@ kFlutterBackingStoreTypeVulkan
Specifies a Vulkan backing store. This is backed by a Vulkan VkImage.
Definition embedder.h:1746
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
Definition embedder.h:1742
@ kFlutterBackingStoreTypeOpenGL
Definition embedder.h:1740

◆ FlutterEngineAOTDataSourceType

AOT data source type.

Enumerator
kFlutterEngineAOTDataSourceTypeElfPath 

Definition at line 2107 of file embedder.h.

2107 {
FlutterEngineAOTDataSourceType
AOT data source type.
Definition embedder.h:2107
@ kFlutterEngineAOTDataSourceTypeElfPath
Definition embedder.h:2108

◆ FlutterEngineDartObjectType

Enumerator
kFlutterEngineDartObjectTypeNull 
kFlutterEngineDartObjectTypeBool 
kFlutterEngineDartObjectTypeInt32 
kFlutterEngineDartObjectTypeInt64 
kFlutterEngineDartObjectTypeDouble 
kFlutterEngineDartObjectTypeString 
kFlutterEngineDartObjectTypeBuffer 

The object will be made available to Dart code as an instance of Uint8List.

Definition at line 2010 of file embedder.h.

2010 {
2017 /// The object will be made available to Dart code as an instance of
2018 /// Uint8List.
FlutterEngineDartObjectType
Definition embedder.h:2010
@ kFlutterEngineDartObjectTypeString
Definition embedder.h:2016
@ kFlutterEngineDartObjectTypeBool
Definition embedder.h:2012
@ kFlutterEngineDartObjectTypeDouble
Definition embedder.h:2015
@ kFlutterEngineDartObjectTypeInt32
Definition embedder.h:2013
@ kFlutterEngineDartObjectTypeBuffer
Definition embedder.h:2019
@ kFlutterEngineDartObjectTypeInt64
Definition embedder.h:2014
@ kFlutterEngineDartObjectTypeNull
Definition embedder.h:2011

◆ FlutterEngineDisplaysUpdateType

The update type parameter that is passed to FlutterEngineNotifyDisplayUpdate.

Enumerator
kFlutterEngineDisplaysUpdateTypeStartup 

FlutterEngineDisplays that were active during start-up. A display is considered active if:

  1. The frame buffer hardware is connected.
  2. The display is drawable, e.g. it isn't being mirrored from another connected display or sleeping.
kFlutterEngineDisplaysUpdateTypeCount 

Definition at line 1998 of file embedder.h.

1998 {
1999 /// `FlutterEngineDisplay`s that were active during start-up. A display is
2000 /// considered active if:
2001 /// 1. The frame buffer hardware is connected.
2002 /// 2. The display is drawable, e.g. it isn't being mirrored from another
2003 /// connected display or sleeping.
FlutterEngineDisplaysUpdateType
Definition embedder.h:1998
@ kFlutterEngineDisplaysUpdateTypeStartup
Definition embedder.h:2004
@ kFlutterEngineDisplaysUpdateTypeCount
Definition embedder.h:2005

◆ FlutterEngineResult

Enumerator
kSuccess 
kInvalidLibraryVersion 
kInvalidArguments 
kInternalInconsistency 

Definition at line 72 of file embedder.h.

72 {
73 kSuccess = 0,
FlutterEngineResult
Definition embedder.h:72
@ kInternalInconsistency
Definition embedder.h:76
@ kInvalidLibraryVersion
Definition embedder.h:74
@ kInvalidArguments
Definition embedder.h:75
@ kSuccess
Definition embedder.h:73

◆ FlutterKeyEventDeviceType

Enumerator
kFlutterKeyEventDeviceTypeKeyboard 
kFlutterKeyEventDeviceTypeDirectionalPad 
kFlutterKeyEventDeviceTypeGamepad 
kFlutterKeyEventDeviceTypeJoystick 
kFlutterKeyEventDeviceTypeHdmi 

Definition at line 1078 of file embedder.h.

1078 {
FlutterKeyEventDeviceType
Definition embedder.h:1078
@ kFlutterKeyEventDeviceTypeKeyboard
Definition embedder.h:1079
@ kFlutterKeyEventDeviceTypeDirectionalPad
Definition embedder.h:1080
@ kFlutterKeyEventDeviceTypeHdmi
Definition embedder.h:1083
@ kFlutterKeyEventDeviceTypeJoystick
Definition embedder.h:1082
@ kFlutterKeyEventDeviceTypeGamepad
Definition embedder.h:1081

◆ FlutterKeyEventType

Enumerator
kFlutterKeyEventTypeUp 
kFlutterKeyEventTypeDown 
kFlutterKeyEventTypeRepeat 

Definition at line 1072 of file embedder.h.

1072 {
FlutterKeyEventType
Definition embedder.h:1072
@ kFlutterKeyEventTypeDown
Definition embedder.h:1074
@ kFlutterKeyEventTypeUp
Definition embedder.h:1073
@ kFlutterKeyEventTypeRepeat
Definition embedder.h:1075

◆ FlutterLayerContentType

Enumerator
kFlutterLayerContentTypeBackingStore 

Indicates that the contents of this layer are rendered by Flutter into a backing store.

kFlutterLayerContentTypePlatformView 

Indicates that the contents of this layer are determined by the embedder.

Definition at line 1788 of file embedder.h.

1788 {
1789 /// Indicates that the contents of this layer are rendered by Flutter into a
1790 /// backing store.
1792 /// Indicates that the contents of this layer are determined by the embedder.
FlutterLayerContentType
Definition embedder.h:1788
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
Definition embedder.h:1793
@ kFlutterLayerContentTypeBackingStore
Definition embedder.h:1791

◆ FlutterMetalExternalTexturePixelFormat

Pixel format for the external texture.

Enumerator
kYUVA 
kRGBA 

Definition at line 603 of file embedder.h.

603 {
604 kYUVA,
605 kRGBA,
FlutterMetalExternalTexturePixelFormat
Pixel format for the external texture.
Definition embedder.h:603
@ kRGBA
Definition embedder.h:605
@ kYUVA
Definition embedder.h:604

◆ FlutterMetalExternalTextureYUVColorSpace

YUV color space for the YUV external texture.

Enumerator
kBT601FullRange 
kBT601LimitedRange 

Definition at line 609 of file embedder.h.

609 {
FlutterMetalExternalTextureYUVColorSpace
YUV color space for the YUV external texture.
Definition embedder.h:609
@ kBT601LimitedRange
Definition embedder.h:611
@ kBT601FullRange
Definition embedder.h:610

◆ FlutterNativeThreadType

This enum allows embedders to determine the type of the engine thread in the FlutterNativeThreadCallback. Based on the thread type, the embedder may be able to tweak the thread priorities for optimum performance.

Enumerator
kFlutterNativeThreadTypePlatform 

The Flutter Engine considers the thread on which the FlutterEngineRun call is made to be the platform thread. There is only one such thread per engine instance.

kFlutterNativeThreadTypeRender 

This is the thread the Flutter Engine uses to execute rendering commands based on the selected client rendering API. There is only one such thread per engine instance.

kFlutterNativeThreadTypeUI 

This is a dedicated thread on which the root Dart isolate is serviced. There is only one such thread per engine instance.

kFlutterNativeThreadTypeWorker 

Multiple threads are used by the Flutter engine to perform long running background tasks.

Definition at line 2084 of file embedder.h.

2084 {
2085 /// The Flutter Engine considers the thread on which the FlutterEngineRun call
2086 /// is made to be the platform thread. There is only one such thread per
2087 /// engine instance.
2089 /// This is the thread the Flutter Engine uses to execute rendering commands
2090 /// based on the selected client rendering API. There is only one such thread
2091 /// per engine instance.
2093 /// This is a dedicated thread on which the root Dart isolate is serviced.
2094 /// There is only one such thread per engine instance.
2096 /// Multiple threads are used by the Flutter engine to perform long running
2097 /// background tasks.
FlutterNativeThreadType
Definition embedder.h:2084
@ kFlutterNativeThreadTypeWorker
Definition embedder.h:2098
@ kFlutterNativeThreadTypeUI
Definition embedder.h:2095
@ kFlutterNativeThreadTypePlatform
Definition embedder.h:2088
@ kFlutterNativeThreadTypeRender
Definition embedder.h:2092

◆ FlutterOpenGLTargetType

Enumerator
kFlutterOpenGLTargetTypeTexture 

Specifies an OpenGL texture target type. Textures are specified using the FlutterOpenGLTexture struct.

kFlutterOpenGLTargetTypeFramebuffer 

Specifies an OpenGL frame-buffer target type. Framebuffers are specified using the FlutterOpenGLFramebuffer struct.

Definition at line 298 of file embedder.h.

298 {
299 /// Specifies an OpenGL texture target type. Textures are specified using
300 /// the FlutterOpenGLTexture struct.
302 /// Specifies an OpenGL frame-buffer target type. Framebuffers are specified
303 /// using the FlutterOpenGLFramebuffer struct.
FlutterOpenGLTargetType
Definition embedder.h:298
@ kFlutterOpenGLTargetTypeFramebuffer
Definition embedder.h:304
@ kFlutterOpenGLTargetTypeTexture
Definition embedder.h:301

◆ FlutterPlatformViewMutationType

Enumerator
kFlutterPlatformViewMutationTypeOpacity 

Indicates that the Flutter application requested that an opacity be applied to the platform view.

kFlutterPlatformViewMutationTypeClipRect 

Indicates that the Flutter application requested that the platform view be clipped using a rectangle.

kFlutterPlatformViewMutationTypeClipRoundedRect 

Indicates that the Flutter application requested that the platform view be clipped using a rounded rectangle.

kFlutterPlatformViewMutationTypeTransformation 

Indicates that the Flutter application requested that the platform view be transformed before composition.

Definition at line 1686 of file embedder.h.

1686 {
1687 /// Indicates that the Flutter application requested that an opacity be
1688 /// applied to the platform view.
1690 /// Indicates that the Flutter application requested that the platform view be
1691 /// clipped using a rectangle.
1693 /// Indicates that the Flutter application requested that the platform view be
1694 /// clipped using a rounded rectangle.
1696 /// Indicates that the Flutter application requested that the platform view be
1697 /// transformed before composition.
FlutterPlatformViewMutationType
Definition embedder.h:1686
@ kFlutterPlatformViewMutationTypeClipRoundedRect
Definition embedder.h:1695
@ kFlutterPlatformViewMutationTypeClipRect
Definition embedder.h:1692
@ kFlutterPlatformViewMutationTypeTransformation
Definition embedder.h:1698
@ kFlutterPlatformViewMutationTypeOpacity
Definition embedder.h:1689

◆ FlutterPointerDeviceKind

The device type that created a pointer event.

Enumerator
kFlutterPointerDeviceKindMouse 
kFlutterPointerDeviceKindTouch 
kFlutterPointerDeviceKindStylus 
kFlutterPointerDeviceKindTrackpad 

Definition at line 1005 of file embedder.h.

1005 {
FlutterPointerDeviceKind
The device type that created a pointer event.
Definition embedder.h:1005
@ kFlutterPointerDeviceKindTouch
Definition embedder.h:1007
@ kFlutterPointerDeviceKindTrackpad
Definition embedder.h:1009
@ kFlutterPointerDeviceKindStylus
Definition embedder.h:1008
@ kFlutterPointerDeviceKindMouse
Definition embedder.h:1006

◆ FlutterPointerMouseButtons

Flags for the buttons field of FlutterPointerEvent when device_kind is kFlutterPointerDeviceKindMouse.

Enumerator
kFlutterPointerButtonMousePrimary 
kFlutterPointerButtonMouseSecondary 
kFlutterPointerButtonMouseMiddle 
kFlutterPointerButtonMouseBack 
kFlutterPointerButtonMouseForward 

Definition at line 1014 of file embedder.h.

1014 {
1020 /// If a mouse has more than five buttons, send higher bit shifted values
1021 /// corresponding to the button number: 1 << 5 for the 6th, etc.
FlutterPointerMouseButtons
Definition embedder.h:1014
@ kFlutterPointerButtonMousePrimary
Definition embedder.h:1015
@ kFlutterPointerButtonMouseMiddle
Definition embedder.h:1017
@ kFlutterPointerButtonMouseForward
Definition embedder.h:1019
@ kFlutterPointerButtonMouseBack
Definition embedder.h:1018
@ kFlutterPointerButtonMouseSecondary
Definition embedder.h:1016

◆ FlutterPointerPhase

The phase of the pointer event.

Enumerator
kCancel 
kUp 

The pointer, which must have been down (see kDown), is now up.

For touch, this means that the pointer is no longer in contact with the screen. For a mouse, it means the last button was released. Note that if any other buttons are still pressed when one button is released, that should be sent as a kMove rather than a kUp.

kDown 

The pointer, which must have been up, is now down.

For touch, this means that the pointer has come into contact with the screen. For a mouse, it means a button is now pressed. Note that if any other buttons are already pressed when a new button is pressed, that should be sent as a kMove rather than a kDown.

kMove 

The pointer moved while down.

This is also used for changes in button state that don't cause a kDown or kUp, such as releasing one of two pressed buttons.

kAdd 

The pointer is now sending input to Flutter. For instance, a mouse has entered the area where the Flutter content is displayed.

A pointer should always be added before sending any other events.

kRemove 

The pointer is no longer sending input to Flutter. For instance, a mouse has left the area where the Flutter content is displayed.

A removed pointer should no longer send events until sending a new kAdd.

kHover 

The pointer moved while up.

kPanZoomStart 

A pan/zoom started on this pointer.

kPanZoomUpdate 

The pan/zoom updated.

kPanZoomEnd 

The pan/zoom ended.

Definition at line 963 of file embedder.h.

963 {
964 kCancel,
965 /// The pointer, which must have been down (see kDown), is now up.
966 ///
967 /// For touch, this means that the pointer is no longer in contact with the
968 /// screen. For a mouse, it means the last button was released. Note that if
969 /// any other buttons are still pressed when one button is released, that
970 /// should be sent as a kMove rather than a kUp.
971 kUp,
972 /// The pointer, which must have been up, is now down.
973 ///
974 /// For touch, this means that the pointer has come into contact with the
975 /// screen. For a mouse, it means a button is now pressed. Note that if any
976 /// other buttons are already pressed when a new button is pressed, that
977 /// should be sent as a kMove rather than a kDown.
978 kDown,
979 /// The pointer moved while down.
980 ///
981 /// This is also used for changes in button state that don't cause a kDown or
982 /// kUp, such as releasing one of two pressed buttons.
983 kMove,
984 /// The pointer is now sending input to Flutter. For instance, a mouse has
985 /// entered the area where the Flutter content is displayed.
986 ///
987 /// A pointer should always be added before sending any other events.
988 kAdd,
989 /// The pointer is no longer sending input to Flutter. For instance, a mouse
990 /// has left the area where the Flutter content is displayed.
991 ///
992 /// A removed pointer should no longer send events until sending a new kAdd.
993 kRemove,
994 /// The pointer moved while up.
995 kHover,
996 /// A pan/zoom started on this pointer.
998 /// The pan/zoom updated.
1000 /// The pan/zoom ended.
FlutterPointerPhase
The phase of the pointer event.
Definition embedder.h:963
@ kPanZoomUpdate
The pan/zoom updated.
Definition embedder.h:999
@ kHover
The pointer moved while up.
Definition embedder.h:995
@ kUp
Definition embedder.h:971
@ kPanZoomStart
A pan/zoom started on this pointer.
Definition embedder.h:997
@ kRemove
Definition embedder.h:993
@ kCancel
Definition embedder.h:964
@ kDown
Definition embedder.h:978
@ kAdd
Definition embedder.h:988
@ kMove
Definition embedder.h:983
@ kPanZoomEnd
The pan/zoom ended.
Definition embedder.h:1001

◆ FlutterPointerSignalKind

The type of a pointer signal.

Enumerator
kFlutterPointerSignalKindNone 
kFlutterPointerSignalKindScroll 
kFlutterPointerSignalKindScrollInertiaCancel 
kFlutterPointerSignalKindScale 

Definition at line 1025 of file embedder.h.

1025 {
FlutterPointerSignalKind
The type of a pointer signal.
Definition embedder.h:1025
@ kFlutterPointerSignalKindScale
Definition embedder.h:1029
@ kFlutterPointerSignalKindScrollInertiaCancel
Definition embedder.h:1028
@ kFlutterPointerSignalKindScroll
Definition embedder.h:1027
@ kFlutterPointerSignalKindNone
Definition embedder.h:1026

◆ FlutterRendererType

Enumerator
kOpenGL 
kSoftware 
kMetal 

Metal is only supported on Darwin platforms (macOS / iOS). iOS version >= 10.0 (device), 13.0 (simulator) macOS version >= 10.14

kVulkan 

Definition at line 79 of file embedder.h.

79 {
80 kOpenGL,
82 /// Metal is only supported on Darwin platforms (macOS / iOS).
83 /// iOS version >= 10.0 (device), 13.0 (simulator)
84 /// macOS version >= 10.14
85 kMetal,
86 kVulkan,
FlutterRendererType
Definition embedder.h:79
@ kVulkan
Definition embedder.h:86
@ kOpenGL
Definition embedder.h:80
@ kMetal
Definition embedder.h:85
@ kSoftware
Definition embedder.h:81

◆ FlutterSemanticsAction

The set of possible actions that can be conveyed to a semantics node.

Must match the SemanticsAction enum in semantics.dart.

Enumerator
kFlutterSemanticsActionTap 

The equivalent of a user briefly tapping the screen with the finger without moving it.

kFlutterSemanticsActionLongPress 

The equivalent of a user pressing and holding the screen with the finger for a few seconds without moving it.

kFlutterSemanticsActionScrollLeft 

The equivalent of a user moving their finger across the screen from right to left.

kFlutterSemanticsActionScrollRight 

The equivalent of a user moving their finger across the screen from left to right.

kFlutterSemanticsActionScrollUp 

The equivalent of a user moving their finger across the screen from bottom to top.

kFlutterSemanticsActionScrollDown 

The equivalent of a user moving their finger across the screen from top to bottom.

kFlutterSemanticsActionIncrease 

Increase the value represented by the semantics node.

kFlutterSemanticsActionDecrease 

Decrease the value represented by the semantics node.

kFlutterSemanticsActionShowOnScreen 

A request to fully show the semantics node on screen.

kFlutterSemanticsActionMoveCursorForwardByCharacter 

Move the cursor forward by one character.

kFlutterSemanticsActionMoveCursorBackwardByCharacter 

Move the cursor backward by one character.

kFlutterSemanticsActionSetSelection 

Set the text selection to the given range.

kFlutterSemanticsActionCopy 

Copy the current selection to the clipboard.

kFlutterSemanticsActionCut 

Cut the current selection and place it in the clipboard.

kFlutterSemanticsActionPaste 

Paste the current content of the clipboard.

kFlutterSemanticsActionDidGainAccessibilityFocus 

Indicate that the node has gained accessibility focus.

kFlutterSemanticsActionDidLoseAccessibilityFocus 

Indicate that the node has lost accessibility focus.

kFlutterSemanticsActionCustomAction 

Indicate that the user has invoked a custom accessibility action.

kFlutterSemanticsActionDismiss 

A request that the node should be dismissed.

kFlutterSemanticsActionMoveCursorForwardByWord 

Move the cursor forward by one word.

kFlutterSemanticsActionMoveCursorBackwardByWord 

Move the cursor backward by one word.

kFlutterSemanticsActionSetText 

Replace the current text in the text field.

Definition at line 113 of file embedder.h.

113 {
114 /// The equivalent of a user briefly tapping the screen with the finger
115 /// without moving it.
117 /// The equivalent of a user pressing and holding the screen with the finger
118 /// for a few seconds without moving it.
120 /// The equivalent of a user moving their finger across the screen from right
121 /// to left.
123 /// The equivalent of a user moving their finger across the screen from left
124 /// to
125 /// right.
127 /// The equivalent of a user moving their finger across the screen from bottom
128 /// to top.
130 /// The equivalent of a user moving their finger across the screen from top to
131 /// bottom.
133 /// Increase the value represented by the semantics node.
135 /// Decrease the value represented by the semantics node.
137 /// A request to fully show the semantics node on screen.
139 /// Move the cursor forward by one character.
141 /// Move the cursor backward by one character.
143 /// Set the text selection to the given range.
145 /// Copy the current selection to the clipboard.
147 /// Cut the current selection and place it in the clipboard.
149 /// Paste the current content of the clipboard.
151 /// Indicate that the node has gained accessibility focus.
153 /// Indicate that the node has lost accessibility focus.
155 /// Indicate that the user has invoked a custom accessibility action.
157 /// A request that the node should be dismissed.
159 /// Move the cursor forward by one word.
161 /// Move the cursor backward by one word.
163 /// Replace the current text in the text field.
FlutterSemanticsAction
Definition embedder.h:113
@ kFlutterSemanticsActionMoveCursorForwardByCharacter
Move the cursor forward by one character.
Definition embedder.h:140
@ kFlutterSemanticsActionDidLoseAccessibilityFocus
Indicate that the node has lost accessibility focus.
Definition embedder.h:154
@ kFlutterSemanticsActionDecrease
Decrease the value represented by the semantics node.
Definition embedder.h:136
@ kFlutterSemanticsActionScrollDown
Definition embedder.h:132
@ kFlutterSemanticsActionMoveCursorBackwardByCharacter
Move the cursor backward by one character.
Definition embedder.h:142
@ kFlutterSemanticsActionMoveCursorForwardByWord
Move the cursor forward by one word.
Definition embedder.h:160
@ kFlutterSemanticsActionLongPress
Definition embedder.h:119
@ kFlutterSemanticsActionScrollRight
Definition embedder.h:126
@ kFlutterSemanticsActionShowOnScreen
A request to fully show the semantics node on screen.
Definition embedder.h:138
@ kFlutterSemanticsActionSetSelection
Set the text selection to the given range.
Definition embedder.h:144
@ kFlutterSemanticsActionDismiss
A request that the node should be dismissed.
Definition embedder.h:158
@ kFlutterSemanticsActionPaste
Paste the current content of the clipboard.
Definition embedder.h:150
@ kFlutterSemanticsActionScrollUp
Definition embedder.h:129
@ kFlutterSemanticsActionCut
Cut the current selection and place it in the clipboard.
Definition embedder.h:148
@ kFlutterSemanticsActionCustomAction
Indicate that the user has invoked a custom accessibility action.
Definition embedder.h:156
@ kFlutterSemanticsActionCopy
Copy the current selection to the clipboard.
Definition embedder.h:146
@ kFlutterSemanticsActionMoveCursorBackwardByWord
Move the cursor backward by one word.
Definition embedder.h:162
@ kFlutterSemanticsActionIncrease
Increase the value represented by the semantics node.
Definition embedder.h:134
@ kFlutterSemanticsActionScrollLeft
Definition embedder.h:122
@ kFlutterSemanticsActionDidGainAccessibilityFocus
Indicate that the node has gained accessibility focus.
Definition embedder.h:152
@ kFlutterSemanticsActionSetText
Replace the current text in the text field.
Definition embedder.h:164
@ kFlutterSemanticsActionTap
Definition embedder.h:116

◆ FlutterSemanticsFlag

The set of properties that may be associated with a semantics node.

Must match the SemanticsFlag enum in semantics.dart.

Enumerator
kFlutterSemanticsFlagHasCheckedState 

The semantics node has the quality of either being "checked" or "unchecked".

kFlutterSemanticsFlagIsChecked 

Whether a semantics node is checked.

kFlutterSemanticsFlagIsSelected 

Whether a semantics node is selected.

kFlutterSemanticsFlagIsButton 

Whether the semantic node represents a button.

kFlutterSemanticsFlagIsTextField 

Whether the semantic node represents a text field.

kFlutterSemanticsFlagIsFocused 

Whether the semantic node currently holds the user's focus.

kFlutterSemanticsFlagHasEnabledState 

The semantics node has the quality of either being "enabled" or "disabled".

kFlutterSemanticsFlagIsEnabled 

Whether a semantic node that hasEnabledState is currently enabled.

kFlutterSemanticsFlagIsInMutuallyExclusiveGroup 

Whether a semantic node is in a mutually exclusive group.

kFlutterSemanticsFlagIsHeader 

Whether a semantic node is a header that divides content into sections.

kFlutterSemanticsFlagIsObscured 

Whether the value of the semantics node is obscured.

kFlutterSemanticsFlagScopesRoute 

Whether the semantics node is the root of a subtree for which a route name should be announced.

kFlutterSemanticsFlagNamesRoute 

Whether the semantics node label is the name of a visually distinct route.

kFlutterSemanticsFlagIsHidden 

Whether the semantics node is considered hidden.

kFlutterSemanticsFlagIsImage 

Whether the semantics node represents an image.

kFlutterSemanticsFlagIsLiveRegion 

Whether the semantics node is a live region.

kFlutterSemanticsFlagHasToggledState 

The semantics node has the quality of either being "on" or "off".

kFlutterSemanticsFlagIsToggled 

If true, the semantics node is "on". If false, the semantics node is "off".

kFlutterSemanticsFlagHasImplicitScrolling 

Whether the platform can scroll the semantics node when the user attempts to move the accessibility focus to an offscreen child.

For example, a ListView widget has implicit scrolling so that users can easily move the accessibility focus to the next set of children. A PageView widget does not have implicit scrolling, so that users don't navigate to the next page when reaching the end of the current one.

kFlutterSemanticsFlagIsMultiline 

Whether the value of the semantics node is coming from a multi-line text field.

This is used for text fields to distinguish single-line text fields from multi-line ones.

kFlutterSemanticsFlagIsReadOnly 

Whether the semantic node is read only.

Only applicable when kFlutterSemanticsFlagIsTextField flag is on.

kFlutterSemanticsFlagIsFocusable 

Whether the semantic node can hold the user's focus.

kFlutterSemanticsFlagIsLink 

Whether the semantics node represents a link.

kFlutterSemanticsFlagIsSlider 

Whether the semantics node represents a slider.

kFlutterSemanticsFlagIsKeyboardKey 

Whether the semantics node represents a keyboard key.

kFlutterSemanticsFlagIsCheckStateMixed 

Whether the semantics node represents a tristate checkbox in mixed state.

kFlutterSemanticsFlagHasExpandedState 

The semantics node has the quality of either being "expanded" or "collapsed".

kFlutterSemanticsFlagIsExpanded 

Whether a semantic node that hasExpandedState is currently expanded.

Definition at line 170 of file embedder.h.

170 {
171 /// The semantics node has the quality of either being "checked" or
172 /// "unchecked".
174 /// Whether a semantics node is checked.
176 /// Whether a semantics node is selected.
178 /// Whether the semantic node represents a button.
180 /// Whether the semantic node represents a text field.
182 /// Whether the semantic node currently holds the user's focus.
184 /// The semantics node has the quality of either being "enabled" or
185 /// "disabled".
187 /// Whether a semantic node that hasEnabledState is currently enabled.
189 /// Whether a semantic node is in a mutually exclusive group.
191 /// Whether a semantic node is a header that divides content into sections.
193 /// Whether the value of the semantics node is obscured.
195 /// Whether the semantics node is the root of a subtree for which a route name
196 /// should be announced.
198 /// Whether the semantics node label is the name of a visually distinct route.
200 /// Whether the semantics node is considered hidden.
202 /// Whether the semantics node represents an image.
204 /// Whether the semantics node is a live region.
206 /// The semantics node has the quality of either being "on" or "off".
208 /// If true, the semantics node is "on". If false, the semantics node is
209 /// "off".
211 /// Whether the platform can scroll the semantics node when the user attempts
212 /// to move the accessibility focus to an offscreen child.
213 ///
214 /// For example, a `ListView` widget has implicit scrolling so that users can
215 /// easily move the accessibility focus to the next set of children. A
216 /// `PageView` widget does not have implicit scrolling, so that users don't
217 /// navigate to the next page when reaching the end of the current one.
219 /// Whether the value of the semantics node is coming from a multi-line text
220 /// field.
221 ///
222 /// This is used for text fields to distinguish single-line text fields from
223 /// multi-line ones.
225 /// Whether the semantic node is read only.
226 ///
227 /// Only applicable when kFlutterSemanticsFlagIsTextField flag is on.
229 /// Whether the semantic node can hold the user's focus.
231 /// Whether the semantics node represents a link.
233 /// Whether the semantics node represents a slider.
235 /// Whether the semantics node represents a keyboard key.
237 /// Whether the semantics node represents a tristate checkbox in mixed state.
239 /// The semantics node has the quality of either being "expanded" or
240 /// "collapsed".
242 /// Whether a semantic node that hasExpandedState is currently expanded.
FlutterSemanticsFlag
Definition embedder.h:170
@ kFlutterSemanticsFlagIsHidden
Whether the semantics node is considered hidden.
Definition embedder.h:201
@ kFlutterSemanticsFlagIsHeader
Whether a semantic node is a header that divides content into sections.
Definition embedder.h:192
@ kFlutterSemanticsFlagIsSlider
Whether the semantics node represents a slider.
Definition embedder.h:234
@ kFlutterSemanticsFlagHasToggledState
The semantics node has the quality of either being "on" or "off".
Definition embedder.h:207
@ kFlutterSemanticsFlagIsSelected
Whether a semantics node is selected.
Definition embedder.h:177
@ kFlutterSemanticsFlagIsInMutuallyExclusiveGroup
Whether a semantic node is in a mutually exclusive group.
Definition embedder.h:190
@ kFlutterSemanticsFlagIsKeyboardKey
Whether the semantics node represents a keyboard key.
Definition embedder.h:236
@ kFlutterSemanticsFlagIsChecked
Whether a semantics node is checked.
Definition embedder.h:175
@ kFlutterSemanticsFlagScopesRoute
Definition embedder.h:197
@ kFlutterSemanticsFlagHasExpandedState
Definition embedder.h:241
@ kFlutterSemanticsFlagIsCheckStateMixed
Whether the semantics node represents a tristate checkbox in mixed state.
Definition embedder.h:238
@ kFlutterSemanticsFlagIsToggled
Definition embedder.h:210
@ kFlutterSemanticsFlagIsButton
Whether the semantic node represents a button.
Definition embedder.h:179
@ kFlutterSemanticsFlagIsMultiline
Definition embedder.h:224
@ kFlutterSemanticsFlagIsObscured
Whether the value of the semantics node is obscured.
Definition embedder.h:194
@ kFlutterSemanticsFlagIsReadOnly
Definition embedder.h:228
@ kFlutterSemanticsFlagIsLink
Whether the semantics node represents a link.
Definition embedder.h:232
@ kFlutterSemanticsFlagIsLiveRegion
Whether the semantics node is a live region.
Definition embedder.h:205
@ kFlutterSemanticsFlagIsFocused
Whether the semantic node currently holds the user's focus.
Definition embedder.h:183
@ kFlutterSemanticsFlagHasImplicitScrolling
Definition embedder.h:218
@ kFlutterSemanticsFlagIsEnabled
Whether a semantic node that hasEnabledState is currently enabled.
Definition embedder.h:188
@ kFlutterSemanticsFlagIsImage
Whether the semantics node represents an image.
Definition embedder.h:203
@ kFlutterSemanticsFlagNamesRoute
Whether the semantics node label is the name of a visually distinct route.
Definition embedder.h:199
@ kFlutterSemanticsFlagIsFocusable
Whether the semantic node can hold the user's focus.
Definition embedder.h:230
@ kFlutterSemanticsFlagIsTextField
Whether the semantic node represents a text field.
Definition embedder.h:181
@ kFlutterSemanticsFlagHasCheckedState
Definition embedder.h:173
@ kFlutterSemanticsFlagHasEnabledState
Definition embedder.h:186
@ kFlutterSemanticsFlagIsExpanded
Whether a semantic node that hasExpandedState is currently expanded.
Definition embedder.h:243

◆ FlutterSoftwarePixelFormat

A pixel format to be used for software rendering.

A single pixel always stored as a POT number of bytes. (so in practice either 1, 2, 4, 8, 16 bytes per pixel)

There are two kinds of pixel formats:

  • formats where all components are 8 bits, called array formats The component order as specified in the pixel format name is the order of the components' bytes in memory, with the leftmost component occupying the lowest memory address.
  • all other formats are called packed formats, and the component order as specified in the format name refers to the order in the native type. for example, for kFlutterSoftwarePixelFormatRGB565, the R component uses the 5 least significant bits of the uint16_t pixel value.

Each pixel format in this list is documented with an example on how to get the color components from the pixel.

  • for packed formats, p is the pixel value as a word. For example, you can get the pixel value for a RGB565 formatted buffer like this: uint16_t p = ((const uint16_t*) allocation)[row_bytes * y / bpp + x]; (with bpp being the bytes per pixel, so 2 for RGB565)
  • for array formats, p is a pointer to the pixel value. For example, you can get the p for a RGBA8888 formatted buffer like this: const uint8_t p = ((const uint8_t) allocation) + row_bytes*y + x*4;
Enumerator
kFlutterSoftwarePixelFormatGray8 

pixel with 8 bit grayscale value. The grayscale value is the luma value calculated from r, g, b according to BT.709. (gray = r*0.2126 + g*0.7152 + b*0.0722)

kFlutterSoftwarePixelFormatRGB565 

pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word. r = p & 0x3F; g = (p>>5) & 0x3F; b = p>>11;

kFlutterSoftwarePixelFormatRGBA4444 

pixel with 4 bits for alpha, red, green, blue; in 16-bit word. r = p & 0xF; g = (p>>4) & 0xF; b = (p>>8) & 0xF; a = p>>12;

kFlutterSoftwarePixelFormatRGBA8888 

pixel with 8 bits for red, green, blue, alpha. r = p[0]; g = p[1]; b = p[2]; a = p[3];

kFlutterSoftwarePixelFormatRGBX8888 

pixel with 8 bits for red, green and blue and 8 unused bits. r = p[0]; g = p[1]; b = p[2];

kFlutterSoftwarePixelFormatBGRA8888 

pixel with 8 bits for blue, green, red and alpha. r = p[2]; g = p[1]; b = p[0]; a = p[3];

kFlutterSoftwarePixelFormatNative32 

either kFlutterSoftwarePixelFormatBGRA8888 or kFlutterSoftwarePixelFormatRGBA8888 depending on CPU endianess and OS

Definition at line 333 of file embedder.h.

333 {
334 /// pixel with 8 bit grayscale value.
335 /// The grayscale value is the luma value calculated from r, g, b
336 /// according to BT.709. (gray = r*0.2126 + g*0.7152 + b*0.0722)
338
339 /// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word.
340 /// r = p & 0x3F; g = (p>>5) & 0x3F; b = p>>11;
342
343 /// pixel with 4 bits for alpha, red, green, blue; in 16-bit word.
344 /// r = p & 0xF; g = (p>>4) & 0xF; b = (p>>8) & 0xF; a = p>>12;
346
347 /// pixel with 8 bits for red, green, blue, alpha.
348 /// r = p[0]; g = p[1]; b = p[2]; a = p[3];
350
351 /// pixel with 8 bits for red, green and blue and 8 unused bits.
352 /// r = p[0]; g = p[1]; b = p[2];
354
355 /// pixel with 8 bits for blue, green, red and alpha.
356 /// r = p[2]; g = p[1]; b = p[0]; a = p[3];
358
359 /// either kFlutterSoftwarePixelFormatBGRA8888 or
360 /// kFlutterSoftwarePixelFormatRGBA8888 depending on CPU endianess and OS
FlutterSoftwarePixelFormat
Definition embedder.h:333
@ kFlutterSoftwarePixelFormatRGBA4444
Definition embedder.h:345
@ kFlutterSoftwarePixelFormatRGBA8888
Definition embedder.h:349
@ kFlutterSoftwarePixelFormatBGRA8888
Definition embedder.h:357
@ kFlutterSoftwarePixelFormatGray8
Definition embedder.h:337
@ kFlutterSoftwarePixelFormatNative32
Definition embedder.h:361
@ kFlutterSoftwarePixelFormatRGBX8888
Definition embedder.h:353
@ kFlutterSoftwarePixelFormatRGB565
Definition embedder.h:341

◆ FlutterStringAttributeType

Enumerator
kSpellOut 
kLocale 

Definition at line 1198 of file embedder.h.

1198 {
1199 // Indicates the string should be announced character by character.
1200 kSpellOut,
1201 // Indicates the string should be announced using the specified locale.
1202 kLocale,
FlutterStringAttributeType
Definition embedder.h:1198
@ kSpellOut
Definition embedder.h:1200
@ kLocale
Definition embedder.h:1202

◆ FlutterTextDirection

Enumerator
kFlutterTextDirectionUnknown 

Text has unknown text direction.

kFlutterTextDirectionRTL 

Text is read from right to left.

kFlutterTextDirectionLTR 

Text is read from left to right.

Definition at line 246 of file embedder.h.

246 {
247 /// Text has unknown text direction.
249 /// Text is read from right to left.
251 /// Text is read from left to right.
FlutterTextDirection
Definition embedder.h:246
@ kFlutterTextDirectionUnknown
Text has unknown text direction.
Definition embedder.h:248
@ kFlutterTextDirectionRTL
Text is read from right to left.
Definition embedder.h:250
@ kFlutterTextDirectionLTR
Text is read from left to right.
Definition embedder.h:252

◆ FlutterThreadPriority

Valid values for priority of Thread.

Enumerator
kBackground 

Suitable for threads that shouldn't disrupt high priority work.

kNormal 

Default priority level.

kDisplay 

Suitable for threads which generate data for the display.

kRaster 

Suitable for thread which raster data.

Definition at line 256 of file embedder.h.

256 {
257 /// Suitable for threads that shouldn't disrupt high priority work.
258 kBackground = 0,
259 /// Default priority level.
260 kNormal = 1,
261 /// Suitable for threads which generate data for the display.
262 kDisplay = 2,
263 /// Suitable for thread which raster data.
264 kRaster = 3,
FlutterThreadPriority
Valid values for priority of Thread.
Definition embedder.h:256
@ kBackground
Suitable for threads that shouldn't disrupt high priority work.
Definition embedder.h:258
@ kDisplay
Suitable for threads which generate data for the display.
Definition embedder.h:262
@ kNormal
Default priority level.
Definition embedder.h:260
@ kRaster
Suitable for thread which raster data.
Definition embedder.h:264

Function Documentation

◆ __FlutterEngineFlushPendingTasksNow()

FLUTTER_EXPORT FlutterEngineResult __FlutterEngineFlushPendingTasksNow ( )

This API is only meant to be used by platforms that need to flush tasks on a message loop not controlled by the Flutter engine.

Deprecated:
This API will be deprecated and is not part of the stable API. Please use the custom task runners API by setting an appropriate FlutterProjectArgs::custom_task_runners interface. This will yield better performance and the interface is stable.
Returns
The result of the call.

Definition at line 2758 of file embedder.cc.

2758 {
2760 return kSuccess;
2761}
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
void RunExpiredTasksNow()

◆ FlutterEngineAddView()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineAddView ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterAddViewInfo info 
)

Adds a view.

        This is an asynchronous operation. The view should not be used
        until the |info.add_view_callback| is invoked with an |added|
        value of true. The embedder should prepare resources in advance
        but be ready to clean up on failure.

        A frame is scheduled if the operation succeeds.

        The callback is invoked on a thread managed by the engine. The
        embedder should re-thread if needed.

        Attempting to add the implicit view will fail and will return
        kInvalidArguments. Attempting to add a view with an already
        existing view ID will fail, and |info.add_view_callback| will be
        invoked with an |added| value of false.
Parameters
[in]engineA running engine instance.
[in]infoThe add view arguments. This can be deallocated once |FlutterEngineAddView| returns, before |add_view_callback| is invoked.
Returns
The result of starting the asynchronous operation. If kSuccess, the |add_view_callback| will be invoked.

Definition at line 2187 of file embedder.cc.

2189 {
2190 if (!engine) {
2191 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2192 }
2193 if (!info || !info->view_metrics || !info->add_view_callback) {
2195 "Add view info handle was invalid.");
2196 }
2197
2198 FlutterViewId view_id = info->view_id;
2199 if (view_id == kFlutterImplicitViewId) {
2200 return LOG_EMBEDDER_ERROR(
2202 "Add view info was invalid. The implicit view cannot be added.");
2203 }
2204 if (SAFE_ACCESS(info->view_metrics, view_id, kFlutterImplicitViewId) !=
2205 view_id) {
2206 if (view_id == kFlutterImplicitViewId) {
2208 "Add view info was invalid. The info and "
2209 "window metric view IDs must match.");
2210 }
2211 }
2212
2213 // TODO(loicsharma): Return an error if the engine was initialized with
2214 // callbacks that are incompatible with multiple views.
2215 // https://github.com/flutter/flutter/issues/144806
2216
2217 std::variant<flutter::ViewportMetrics, std::string> metrics_or_error =
2219
2220 if (const std::string* error = std::get_if<std::string>(&metrics_or_error)) {
2221 return LOG_EMBEDDER_ERROR(kInvalidArguments, error->c_str());
2222 }
2223
2224 auto metrics = std::get<flutter::ViewportMetrics>(metrics_or_error);
2225
2226 // The engine must be running to add a view.
2227 auto embedder_engine = reinterpret_cast<flutter::EmbedderEngine*>(engine);
2228 if (!embedder_engine->IsValid()) {
2229 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2230 }
2231
2233 [c_callback = info->add_view_callback,
2234 user_data = info->user_data](bool added) {
2237 result.added = added;
2238 result.user_data = user_data;
2239 c_callback(&result);
2240 };
2241
2242 embedder_engine->GetShell().GetPlatformView()->AddView(view_id, metrics,
2243 callback);
2244 return kSuccess;
2245}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
std::function< void(bool added)> AddViewCallback
#define LOG_EMBEDDER_ERROR(code, reason)
Definition embedder.cc:152
static constexpr FlutterViewId kFlutterImplicitViewId
Definition embedder.cc:107
static std::variant< flutter::ViewportMetrics, std::string > MakeViewportMetricsFromWindowMetrics(const FlutterWindowMetricsEvent *flutter_metrics)
Definition embedder.cc:1357
int64_t FlutterViewId
Definition embedder.h:273
#define SAFE_ACCESS(pointer, member, default_value)
FlutterEngine engine
Definition main.cc:68
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
GAsyncResult * result

◆ FlutterEngineCollectAOTData()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineCollectAOTData ( FlutterEngineAOTData  data)

Collects the AOT data.

Warning
The embedder must ensure that this call is made only after all FlutterEngine instances launched using this data have been terminated, and that all of those instances were launched with the FlutterProjectArgs::shutdown_dart_vm_when_done flag set to true.
Parameters
[in]dataThe data to collect.
Returns
Returns if the AOT data was successfully collected.

Definition at line 1476 of file embedder.cc.

1476 {
1477 if (!data) {
1478 // Deleting a null object should be a no-op.
1479 return kSuccess;
1480 }
1481
1482 // Created in a unique pointer in `FlutterEngineCreateAOTData`.
1483 delete data;
1484 return kSuccess;
1485}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

◆ FlutterEngineCreateAOTData()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineCreateAOTData ( const FlutterEngineAOTDataSource source,
FlutterEngineAOTData data_out 
)

Creates the necessary data structures to launch a Flutter Dart application in AOT mode. The data may only be collected after all FlutterEngine instances launched using this data have been terminated.

Parameters
[in]sourceThe source of the AOT data.
[out]data_outThe AOT data on success. Unchanged on failure.
Returns
Returns if the AOT data could be successfully resolved.

Definition at line 1422 of file embedder.cc.

1424 {
1427 "AOT data can only be created in AOT mode.");
1428 } else if (!source) {
1429 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Null source specified.");
1430 } else if (!data_out) {
1431 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Null data_out specified.");
1432 }
1433
1434 switch (source->type) {
1436 if (!source->elf_path || !fml::IsFile(source->elf_path)) {
1438 "Invalid ELF path specified.");
1439 }
1440
1441 auto aot_data = std::make_unique<_FlutterEngineAOTData>();
1442 const char* error = nullptr;
1443
1444#if OS_FUCHSIA
1445 // TODO(gw280): https://github.com/flutter/flutter/issues/50285
1446 // Dart doesn't implement Dart_LoadELF on Fuchsia
1447 Dart_LoadedElf* loaded_elf = nullptr;
1448#else
1449 Dart_LoadedElf* loaded_elf = Dart_LoadELF(
1450 source->elf_path, // file path
1451 0, // file offset
1452 &error, // error (out)
1453 &aot_data->vm_snapshot_data, // vm snapshot data (out)
1454 &aot_data->vm_snapshot_instrs, // vm snapshot instr (out)
1455 &aot_data->vm_isolate_data, // vm isolate data (out)
1456 &aot_data->vm_isolate_instrs // vm isolate instr (out)
1457 );
1458#endif
1459
1460 if (loaded_elf == nullptr) {
1462 }
1463
1464 aot_data->loaded_elf.reset(loaded_elf);
1465
1466 *data_out = aot_data.release();
1467 return kSuccess;
1468 }
1469 }
1470
1471 return LOG_EMBEDDER_ERROR(
1473 "Invalid FlutterEngineAOTDataSourceType type specified.");
1474}
static bool IsRunningPrecompiledCode()
Checks if VM instances in the process can run precompiled code. This call can be made at any time and...
Definition dart_vm.cc:205
SkBitmap source
Definition examples.cpp:28
bool IsFile(const std::string &path)
DART_EXPORT Dart_LoadedElf * Dart_LoadELF(const char *filename, uint64_t file_offset, const char **error, const uint8_t **vm_snapshot_data, const uint8_t **vm_snapshot_instrs, const uint8_t **vm_isolate_data, const uint8_t **vm_isolate_instrs)
Please see documentation for Dart_LoadElf_Fd.

◆ FlutterEngineDeinitialize()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineDeinitialize ( FLUTTER_API_SYMBOL(FlutterEngine engine)

Stops running the Flutter engine instance. After this call, the embedder is also guaranteed that no more calls to post tasks onto custom task runners specified by the embedder are made. The Flutter engine handle still needs to be collected via a call to FlutterEngineShutdown.

Parameters
[in]engineThe running engine instance to de-initialize.
Returns
The result of the call to de-initialize the Flutter engine.

Definition at line 2291 of file embedder.cc.

2292 {
2293 if (engine == nullptr) {
2294 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2295 }
2296
2297 auto embedder_engine = reinterpret_cast<flutter::EmbedderEngine*>(engine);
2298 embedder_engine->NotifyDestroyed();
2299 embedder_engine->CollectShell();
2300 return kSuccess;
2301}

◆ FlutterEngineDispatchSemanticsAction()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineDispatchSemanticsAction ( FLUTTER_API_SYMBOL(FlutterEngine engine,
uint64_t  node_id,
FlutterSemanticsAction  action,
const uint8_t *  data,
size_t  data_length 
)

Dispatch a semantics action to the specified semantics node.

Parameters
[in]engineA running engine instance.
[in]node_idThe semantics node identifier.
[in]actionThe semantics action.
[in]dataData associated with the action.
[in]data_lengthThe data length.
Returns
The result of the call.

Definition at line 2849 of file embedder.cc.

2854 {
2855 if (engine == nullptr) {
2856 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2857 }
2858 auto engine_action = static_cast<flutter::SemanticsAction>(action);
2859 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)
2861 node_id, engine_action,
2862 fml::MallocMapping::Copy(data, data_length))) {
2864 "Could not dispatch semantics action.");
2865 }
2866 return kSuccess;
2867}
bool DispatchSemanticsAction(int node_id, flutter::SemanticsAction action, fml::MallocMapping args)
static MallocMapping Copy(const T *begin, const T *end)
Definition mapping.h:162

◆ FlutterEngineGetCurrentTime()

FLUTTER_EXPORT uint64_t FlutterEngineGetCurrentTime ( )

Get the current time in nanoseconds from the clock used by the flutter engine. This is the system monotonic clock.

Returns
The current time in nanoseconds.

Definition at line 2949 of file embedder.cc.

2949 {
2951}
constexpr int64_t ToNanoseconds() const
Definition time_delta.h:61
TimeDelta ToEpochDelta() const
Definition time_point.h:52
static TimePoint Now()
Definition time_point.cc:49

◆ FlutterEngineGetProcAddresses()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineGetProcAddresses ( FlutterEngineProcTable table)

Gets the table of engine function pointers.

Parameters
[out]tableThe table to fill with pointers. This should be zero-initialized, except for struct_size.
Returns
Returns whether the table was successfully populated.

Definition at line 3329 of file embedder.cc.

3330 {
3331 if (!table) {
3332 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Null table specified.");
3333 }
3334#define SET_PROC(member, function) \
3335 if (STRUCT_HAS_MEMBER(table, member)) { \
3336 table->member = &function; \
3337 }
3338
3339 SET_PROC(CreateAOTData, FlutterEngineCreateAOTData);
3340 SET_PROC(CollectAOTData, FlutterEngineCollectAOTData);
3343 SET_PROC(Initialize, FlutterEngineInitialize);
3344 SET_PROC(Deinitialize, FlutterEngineDeinitialize);
3345 SET_PROC(RunInitialized, FlutterEngineRunInitialized);
3346 SET_PROC(SendWindowMetricsEvent, FlutterEngineSendWindowMetricsEvent);
3347 SET_PROC(SendPointerEvent, FlutterEngineSendPointerEvent);
3348 SET_PROC(SendKeyEvent, FlutterEngineSendKeyEvent);
3349 SET_PROC(SendPlatformMessage, FlutterEngineSendPlatformMessage);
3350 SET_PROC(PlatformMessageCreateResponseHandle,
3352 SET_PROC(PlatformMessageReleaseResponseHandle,
3354 SET_PROC(SendPlatformMessageResponse,
3356 SET_PROC(RegisterExternalTexture, FlutterEngineRegisterExternalTexture);
3357 SET_PROC(UnregisterExternalTexture, FlutterEngineUnregisterExternalTexture);
3358 SET_PROC(MarkExternalTextureFrameAvailable,
3360 SET_PROC(UpdateSemanticsEnabled, FlutterEngineUpdateSemanticsEnabled);
3361 SET_PROC(UpdateAccessibilityFeatures,
3363 SET_PROC(DispatchSemanticsAction, FlutterEngineDispatchSemanticsAction);
3365 SET_PROC(ReloadSystemFonts, FlutterEngineReloadSystemFonts);
3366 SET_PROC(TraceEventDurationBegin, FlutterEngineTraceEventDurationBegin);
3367 SET_PROC(TraceEventDurationEnd, FlutterEngineTraceEventDurationEnd);
3368 SET_PROC(TraceEventInstant, FlutterEngineTraceEventInstant);
3369 SET_PROC(PostRenderThreadTask, FlutterEnginePostRenderThreadTask);
3372 SET_PROC(UpdateLocales, FlutterEngineUpdateLocales);
3373 SET_PROC(RunsAOTCompiledDartCode, FlutterEngineRunsAOTCompiledDartCode);
3374 SET_PROC(PostDartObject, FlutterEnginePostDartObject);
3375 SET_PROC(NotifyLowMemoryWarning, FlutterEngineNotifyLowMemoryWarning);
3376 SET_PROC(PostCallbackOnAllNativeThreads,
3378 SET_PROC(NotifyDisplayUpdate, FlutterEngineNotifyDisplayUpdate);
3379 SET_PROC(ScheduleFrame, FlutterEngineScheduleFrame);
3380 SET_PROC(SetNextFrameCallback, FlutterEngineSetNextFrameCallback);
3382 SET_PROC(RemoveView, FlutterEngineRemoveView);
3383#undef SET_PROC
3384
3385 return kSuccess;
3386}
SI F table(const skcms_Curve *curve, F v)
#define SET_PROC(member, function)
void FlutterEngineTraceEventInstant(const char *name)
A profiling utility. Logs a trace duration instant event to the timeline. If the timeline is unavaila...
Definition embedder.cc:2922
FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Mark that a new texture frame is available for a given texture identifier.
Definition embedder.cc:2803
FlutterEngineResult FlutterEngineRunTask(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)
Inform the engine to run the specified task. This task has been given to the engine via the FlutterTa...
Definition embedder.cc:2953
FlutterEngineResult FlutterEngineOnVsync(FLUTTER_API_SYMBOL(FlutterEngine) engine, intptr_t baton, uint64_t frame_start_time_nanos, uint64_t frame_target_time_nanos)
Notify the engine that a vsync event occurred. A baton passed to the platform via the vsync callback ...
Definition embedder.cc:2869
FlutterEngineResult FlutterEngineRun(size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
Initialize and run a Flutter engine instance and return a handle to it. This is a convenience method ...
Definition embedder.cc:1711
FlutterEngineResult FlutterEngineRegisterExternalTexture(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Register an external texture with a unique (per engine) identifier. Only rendering backends that supp...
Definition embedder.cc:2763
FlutterEngineResult FlutterEngineUpdateLocales(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterLocale **locales, size_t locales_count)
Notify a running engine instance that the locale has been updated. The preferred locale must be the f...
Definition embedder.cc:2998
FlutterEngineResult FlutterEngineScheduleFrame(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Schedule a new frame to redraw the content.
Definition embedder.cc:3287
void FlutterEngineTraceEventDurationBegin(const char *name)
A profiling utility. Logs a trace duration begin event to the timeline. If the timeline is unavailabl...
Definition embedder.cc:2913
FlutterEngineResult FlutterEngineSendWindowMetricsEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *flutter_metrics)
Definition embedder.cc:2314
uint64_t FlutterEngineGetCurrentTime()
Get the current time in nanoseconds from the clock used by the flutter engine. This is the system mon...
Definition embedder.cc:2949
FlutterEngineResult FlutterEngineSetNextFrameCallback(FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *user_data)
Schedule a callback to be called after the next frame is drawn. This must be called from the platform...
Definition embedder.cc:3299
FlutterEngineResult FlutterEnginePostRenderThreadTask(FLUTTER_API_SYMBOL(FlutterEngine) engine, VoidCallback callback, void *baton)
Posts a task onto the Flutter render thread. Typically, this may be called from any thread as long as...
Definition embedder.cc:2927
FlutterEngineResult FlutterEngineDispatchSemanticsAction(FLUTTER_API_SYMBOL(FlutterEngine) engine, uint64_t node_id, FlutterSemanticsAction action, const uint8_t *data, size_t data_length)
Dispatch a semantics action to the specified semantics node.
Definition embedder.cc:2849
FlutterEngineResult FlutterEnginePostDartObject(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterEngineDartPort port, const FlutterEngineDartObject *object)
Posts a Dart object to specified send port. The corresponding receive port for send port can be in an...
Definition embedder.cc:3061
FLUTTER_EXPORT FlutterEngineResult FlutterEngineDeinitialize(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Stops running the Flutter engine instance. After this call, the embedder is also guaranteed that no m...
Definition embedder.cc:2291
FlutterEngineResult FlutterEnginePostCallbackOnAllNativeThreads(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterNativeThreadCallback callback, void *user_data)
Schedule a callback to be run on all engine managed threads. The engine will attempt to service this ...
Definition embedder.cc:3207
FLUTTER_EXPORT FlutterEngineResult FlutterEngineAddView(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterAddViewInfo *info)
Adds a view.
Definition embedder.cc:2187
FlutterEngineResult FlutterEngineInitialize(size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
Initialize a Flutter engine instance. This does not run the Flutter application code till the Flutter...
Definition embedder.cc:1727
FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterAccessibilityFeature flags)
Sets additional accessibility features.
Definition embedder.cc:2835
FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embed...
Definition embedder.cc:2303
FlutterEngineResult FlutterPlatformMessageCreateResponseHandle(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterDataCallback data_callback, void *user_data, FlutterPlatformMessageResponseHandle **response_out)
Creates a platform message response handle that allows the embedder to set a native callback for a re...
Definition embedder.cc:2681
FlutterEngineResult FlutterEngineCollectAOTData(FlutterEngineAOTData data)
Collects the AOT data.
Definition embedder.cc:1476
FlutterEngineResult FlutterEngineNotifyDisplayUpdate(FLUTTER_API_SYMBOL(FlutterEngine) raw_engine, const FlutterEngineDisplaysUpdateType update_type, const FlutterEngineDisplay *embedder_displays, size_t display_count)
Posts updates corresponding to display changes to a running engine instance.
Definition embedder.cc:3246
FlutterEngineResult FlutterEngineSendPlatformMessage(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessage *flutter_message)
Definition embedder.cc:2630
bool FlutterEngineRunsAOTCompiledDartCode(void)
Returns if the Flutter engine instance will run AOT compiled Dart code. This call has no threading re...
Definition embedder.cc:3057
FlutterEngineResult FlutterEngineReloadSystemFonts(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Reloads the system fonts in engine.
Definition embedder.cc:2896
FlutterEngineResult FlutterEngineSendPointerEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *pointers, size_t events_count)
Definition embedder.cc:2423
FlutterEngineResult FlutterEngineRunInitialized(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Runs an initialized engine instance. An engine can be initialized via FlutterEngineInitialize....
Definition embedder.cc:2148
FlutterEngineResult FlutterEngineNotifyLowMemoryWarning(FLUTTER_API_SYMBOL(FlutterEngine) raw_engine)
Posts a low memory notification to a running engine instance. The engine will do its best to release ...
Definition embedder.cc:3185
FlutterEngineResult FlutterEngineUnregisterExternalTexture(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Unregister a previous texture registration.
Definition embedder.cc:2782
FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FLUTTER_API_SYMBOL(FlutterEngine) engine, bool enabled)
Enable or disable accessibility semantics.
Definition embedder.cc:2821
FlutterEngineResult FlutterEngineSendKeyEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
Sends a key event to the engine. The framework will decide whether to handle this event in a synchron...
Definition embedder.cc:2575
void FlutterEngineTraceEventDurationEnd(const char *name)
A profiling utility. Logs a trace duration end event to the timeline. If the timeline is unavailable ...
Definition embedder.cc:2918
FlutterEngineResult FlutterEngineSendPlatformMessageResponse(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Send a response from the native side to a platform message from the Dart Flutter application.
Definition embedder.cc:2731
FLUTTER_EXPORT FlutterEngineResult FlutterEngineRemoveView(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterRemoveViewInfo *info)
Removes a view.
Definition embedder.cc:2248
FlutterEngineResult FlutterPlatformMessageReleaseResponseHandle(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterPlatformMessageResponseHandle *response)
Collects the handle created using FlutterPlatformMessageCreateResponseHandle.
Definition embedder.cc:2716
FlutterEngineResult FlutterEngineCreateAOTData(const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)
Creates the necessary data structures to launch a Flutter Dart application in AOT mode....
Definition embedder.cc:1422
#define GetCurrentTime()

◆ FlutterEngineInitialize()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineInitialize ( size_t  version,
const FlutterRendererConfig config,
const FlutterProjectArgs args,
void *  user_data,
FLUTTER_API_SYMBOL(FlutterEngine) *  engine_out 
)

Initialize a Flutter engine instance. This does not run the Flutter application code till the FlutterEngineRunInitialized call is made. Besides Flutter application code, no tasks are scheduled on embedder managed task runners either. This allows embedders providing custom task runners to the Flutter engine to obtain a handle to the Flutter engine before the engine can post tasks on these task runners.

Parameters
[in]versionThe Flutter embedder API version. Must be FLUTTER_ENGINE_VERSION.
[in]configThe renderer configuration.
[in]argsThe Flutter project arguments.
user_dataA user data baton passed back to embedders in callbacks.
[out]engine_outThe engine handle on successful engine creation.
Returns
The result of the call to initialize the Flutter engine.

Definition at line 1727 of file embedder.cc.

1732 {
1733 // Step 0: Figure out arguments for shell creation.
1734 if (version != FLUTTER_ENGINE_VERSION) {
1735 return LOG_EMBEDDER_ERROR(
1737 "Flutter embedder version mismatch. There has been a breaking change. "
1738 "Please consult the changelog and update the embedder.");
1739 }
1740
1741 if (engine_out == nullptr) {
1743 "The engine out parameter was missing.");
1744 }
1745
1746 if (args == nullptr) {
1748 "The Flutter project arguments were missing.");
1749 }
1750
1751 if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr) {
1752 return LOG_EMBEDDER_ERROR(
1754 "The assets path in the Flutter project arguments was missing.");
1755 }
1756
1757 if (SAFE_ACCESS(args, main_path__unused__, nullptr) != nullptr) {
1758 FML_LOG(WARNING)
1759 << "FlutterProjectArgs.main_path is deprecated and should be set null.";
1760 }
1761
1762 if (SAFE_ACCESS(args, packages_path__unused__, nullptr) != nullptr) {
1763 FML_LOG(WARNING) << "FlutterProjectArgs.packages_path is deprecated and "
1764 "should be set null.";
1765 }
1766
1767 if (!IsRendererValid(config)) {
1769 "The renderer configuration was invalid.");
1770 }
1771
1772 std::string icu_data_path;
1773 if (SAFE_ACCESS(args, icu_data_path, nullptr) != nullptr) {
1774 icu_data_path = SAFE_ACCESS(args, icu_data_path, nullptr);
1775 }
1776
1777 if (SAFE_ACCESS(args, persistent_cache_path, nullptr) != nullptr) {
1778 std::string persistent_cache_path =
1779 SAFE_ACCESS(args, persistent_cache_path, nullptr);
1781 }
1782
1783 if (SAFE_ACCESS(args, is_persistent_cache_read_only, false)) {
1785 }
1786
1787 fml::CommandLine command_line;
1788 if (SAFE_ACCESS(args, command_line_argc, 0) != 0 &&
1789 SAFE_ACCESS(args, command_line_argv, nullptr) != nullptr) {
1790 command_line = fml::CommandLineFromArgcArgv(
1791 SAFE_ACCESS(args, command_line_argc, 0),
1792 SAFE_ACCESS(args, command_line_argv, nullptr));
1793 }
1794
1796
1797 if (SAFE_ACCESS(args, aot_data, nullptr)) {
1798 if (SAFE_ACCESS(args, vm_snapshot_data, nullptr) ||
1799 SAFE_ACCESS(args, vm_snapshot_instructions, nullptr) ||
1800 SAFE_ACCESS(args, isolate_snapshot_data, nullptr) ||
1801 SAFE_ACCESS(args, isolate_snapshot_instructions, nullptr)) {
1802 return LOG_EMBEDDER_ERROR(
1804 "Multiple AOT sources specified. Embedders should provide either "
1805 "*_snapshot_* buffers or aot_data, not both.");
1806 }
1807 }
1808
1811 } else {
1813 }
1814
1815 settings.icu_data_path = icu_data_path;
1816 settings.assets_path = args->assets_path;
1817 settings.leak_vm = !SAFE_ACCESS(args, shutdown_dart_vm_when_done, false);
1818 settings.old_gen_heap_size = SAFE_ACCESS(args, dart_old_gen_heap_size, -1);
1819
1821 // Verify the assets path contains Dart 2 kernel assets.
1822 const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin";
1823 std::string application_kernel_path = fml::paths::JoinPaths(
1825 if (!fml::IsFile(application_kernel_path)) {
1826 return LOG_EMBEDDER_ERROR(
1828 "Not running in AOT mode but could not resolve the kernel binary.");
1829 }
1830 settings.application_kernel_asset = kApplicationKernelSnapshotFileName;
1831 }
1832
1833 settings.task_observer_add = [](intptr_t key, const fml::closure& callback) {
1835 };
1836 settings.task_observer_remove = [](intptr_t key) {
1838 };
1839 if (SAFE_ACCESS(args, root_isolate_create_callback, nullptr) != nullptr) {
1841 SAFE_ACCESS(args, root_isolate_create_callback, nullptr);
1842 settings.root_isolate_create_callback =
1843 [callback, user_data](const auto& isolate) { callback(user_data); };
1844 }
1845 if (SAFE_ACCESS(args, log_message_callback, nullptr) != nullptr) {
1847 SAFE_ACCESS(args, log_message_callback, nullptr);
1848 settings.log_message_callback = [callback, user_data](
1849 const std::string& tag,
1850 const std::string& message) {
1851 callback(tag.c_str(), message.c_str(), user_data);
1852 };
1853 }
1854 if (SAFE_ACCESS(args, log_tag, nullptr) != nullptr) {
1855 settings.log_tag = SAFE_ACCESS(args, log_tag, nullptr);
1856 }
1857
1858 bool has_update_semantics_2_callback =
1859 SAFE_ACCESS(args, update_semantics_callback2, nullptr) != nullptr;
1860 bool has_update_semantics_callback =
1861 SAFE_ACCESS(args, update_semantics_callback, nullptr) != nullptr;
1862 bool has_legacy_update_semantics_callback =
1863 SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr ||
1864 SAFE_ACCESS(args, update_semantics_custom_action_callback, nullptr) !=
1865 nullptr;
1866
1867 int semantic_callback_count = (has_update_semantics_2_callback ? 1 : 0) +
1868 (has_update_semantics_callback ? 1 : 0) +
1869 (has_legacy_update_semantics_callback ? 1 : 0);
1870
1871 if (semantic_callback_count > 1) {
1872 return LOG_EMBEDDER_ERROR(
1874 "Multiple semantics update callbacks provided. "
1875 "Embedders should provide either `update_semantics_callback2`, "
1876 "`update_semantics_callback`, or both "
1877 "`update_semantics_node_callback` and "
1878 "`update_semantics_custom_action_callback`.");
1879 }
1880
1882 update_semantics_callback =
1884
1886 platform_message_response_callback = nullptr;
1887 if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) {
1888 platform_message_response_callback =
1889 [ptr = args->platform_message_callback,
1890 user_data](std::unique_ptr<flutter::PlatformMessage> message) {
1891 auto handle = new FlutterPlatformMessageResponseHandle();
1892 const FlutterPlatformMessage incoming_message = {
1893 sizeof(FlutterPlatformMessage), // struct_size
1894 message->channel().c_str(), // channel
1895 message->data().GetMapping(), // message
1896 message->data().GetSize(), // message_size
1897 handle, // response_handle
1898 };
1899 handle->message = std::move(message);
1900 return ptr(&incoming_message, user_data);
1901 };
1902 }
1903
1904 flutter::VsyncWaiterEmbedder::VsyncCallback vsync_callback = nullptr;
1905 if (SAFE_ACCESS(args, vsync_callback, nullptr) != nullptr) {
1906 vsync_callback = [ptr = args->vsync_callback, user_data](intptr_t baton) {
1907 return ptr(user_data, baton);
1908 };
1909 }
1910
1912 compute_platform_resolved_locale_callback = nullptr;
1913 if (SAFE_ACCESS(args, compute_platform_resolved_locale_callback, nullptr) !=
1914 nullptr) {
1915 compute_platform_resolved_locale_callback =
1916 [ptr = args->compute_platform_resolved_locale_callback](
1917 const std::vector<std::string>& supported_locales_data) {
1918 const size_t number_of_strings_per_locale = 3;
1919 size_t locale_count =
1920 supported_locales_data.size() / number_of_strings_per_locale;
1921 std::vector<FlutterLocale> supported_locales;
1922 std::vector<const FlutterLocale*> supported_locales_ptr;
1923 for (size_t i = 0; i < locale_count; ++i) {
1924 supported_locales.push_back(
1925 {.struct_size = sizeof(FlutterLocale),
1926 .language_code =
1927 supported_locales_data[i * number_of_strings_per_locale +
1928 0]
1929 .c_str(),
1930 .country_code =
1931 supported_locales_data[i * number_of_strings_per_locale +
1932 1]
1933 .c_str(),
1934 .script_code =
1935 supported_locales_data[i * number_of_strings_per_locale +
1936 2]
1937 .c_str(),
1938 .variant_code = nullptr});
1939 supported_locales_ptr.push_back(&supported_locales[i]);
1940 }
1941
1942 const FlutterLocale* result =
1943 ptr(supported_locales_ptr.data(), locale_count);
1944
1945 std::unique_ptr<std::vector<std::string>> out =
1946 std::make_unique<std::vector<std::string>>();
1947 if (result) {
1948 std::string language_code(SAFE_ACCESS(result, language_code, ""));
1949 if (language_code != "") {
1950 out->push_back(language_code);
1951 out->emplace_back(SAFE_ACCESS(result, country_code, ""));
1952 out->emplace_back(SAFE_ACCESS(result, script_code, ""));
1953 }
1954 }
1955 return out;
1956 };
1957 }
1958
1960 on_pre_engine_restart_callback = nullptr;
1961 if (SAFE_ACCESS(args, on_pre_engine_restart_callback, nullptr) != nullptr) {
1962 on_pre_engine_restart_callback = [ptr =
1963 args->on_pre_engine_restart_callback,
1964 user_data]() { return ptr(user_data); };
1965 }
1966
1968 nullptr;
1969 if (SAFE_ACCESS(args, channel_update_callback, nullptr) != nullptr) {
1970 channel_update_callback = [ptr = args->channel_update_callback, user_data](
1971 const std::string& name, bool listening) {
1973 listening};
1974 ptr(&update, user_data);
1975 };
1976 }
1977
1978 auto external_view_embedder_result = InferExternalViewEmbedderFromArgs(
1979 SAFE_ACCESS(args, compositor, nullptr), settings.enable_impeller);
1980 if (external_view_embedder_result.second) {
1982 "Compositor arguments were invalid.");
1983 }
1984
1986 {
1987 update_semantics_callback, //
1988 platform_message_response_callback, //
1989 vsync_callback, //
1990 compute_platform_resolved_locale_callback, //
1991 on_pre_engine_restart_callback, //
1992 channel_update_callback, //
1993 };
1994
1995 auto on_create_platform_view = InferPlatformViewCreationCallback(
1996 config, user_data, platform_dispatch_table,
1997 std::move(external_view_embedder_result.first), settings.enable_impeller);
1998
1999 if (!on_create_platform_view) {
2000 return LOG_EMBEDDER_ERROR(
2002 "Could not infer platform view creation callback.");
2003 }
2004
2006 [](flutter::Shell& shell) {
2007 return std::make_unique<flutter::Rasterizer>(shell);
2008 };
2009
2010 using ExternalTextureResolver = flutter::EmbedderExternalTextureResolver;
2011 std::unique_ptr<ExternalTextureResolver> external_texture_resolver;
2012 external_texture_resolver = std::make_unique<ExternalTextureResolver>();
2013
2014#ifdef SHELL_ENABLE_GL
2016 external_texture_callback;
2017 if (config->type == kOpenGL) {
2018 const FlutterOpenGLRendererConfig* open_gl_config = &config->open_gl;
2019 if (SAFE_ACCESS(open_gl_config, gl_external_texture_frame_callback,
2020 nullptr) != nullptr) {
2021 external_texture_callback =
2022 [ptr = open_gl_config->gl_external_texture_frame_callback, user_data](
2023 int64_t texture_identifier, size_t width,
2024 size_t height) -> std::unique_ptr<FlutterOpenGLTexture> {
2025 std::unique_ptr<FlutterOpenGLTexture> texture =
2026 std::make_unique<FlutterOpenGLTexture>();
2027 if (!ptr(user_data, texture_identifier, width, height, texture.get())) {
2028 return nullptr;
2029 }
2030 return texture;
2031 };
2032 external_texture_resolver =
2033 std::make_unique<ExternalTextureResolver>(external_texture_callback);
2034 }
2035 }
2036#endif
2037#ifdef SHELL_ENABLE_METAL
2039 external_texture_metal_callback;
2040 if (config->type == kMetal) {
2041 const FlutterMetalRendererConfig* metal_config = &config->metal;
2042 if (SAFE_ACCESS(metal_config, external_texture_frame_callback, nullptr)) {
2043 external_texture_metal_callback =
2044 [ptr = metal_config->external_texture_frame_callback, user_data](
2045 int64_t texture_identifier, size_t width,
2046 size_t height) -> std::unique_ptr<FlutterMetalExternalTexture> {
2047 std::unique_ptr<FlutterMetalExternalTexture> texture =
2048 std::make_unique<FlutterMetalExternalTexture>();
2049 texture->struct_size = sizeof(FlutterMetalExternalTexture);
2050 if (!ptr(user_data, texture_identifier, width, height, texture.get())) {
2051 return nullptr;
2052 }
2053 return texture;
2054 };
2055 external_texture_resolver = std::make_unique<ExternalTextureResolver>(
2056 external_texture_metal_callback);
2057 }
2058 }
2059#endif
2060 auto custom_task_runners = SAFE_ACCESS(args, custom_task_runners, nullptr);
2061 auto thread_config_callback = [&custom_task_runners](
2062 const fml::Thread::ThreadConfig& config) {
2064 if (!custom_task_runners || !custom_task_runners->thread_priority_setter) {
2065 return;
2066 }
2068 switch (config.priority) {
2071 break;
2074 break;
2077 break;
2080 break;
2081 }
2082 custom_task_runners->thread_priority_setter(priority);
2083 };
2084 auto thread_host =
2086 custom_task_runners, thread_config_callback);
2087
2088 if (!thread_host || !thread_host->IsValid()) {
2090 "Could not set up or infer thread configuration "
2091 "to run the Flutter engine on.");
2092 }
2093
2094 auto task_runners = thread_host->GetTaskRunners();
2095
2096 if (!task_runners.IsValid()) {
2098 "Task runner configuration was invalid.");
2099 }
2100
2101 auto run_configuration =
2103
2104 if (SAFE_ACCESS(args, custom_dart_entrypoint, nullptr) != nullptr) {
2105 auto dart_entrypoint = std::string{args->custom_dart_entrypoint};
2106 if (!dart_entrypoint.empty()) {
2107 run_configuration.SetEntrypoint(std::move(dart_entrypoint));
2108 }
2109 }
2110
2111 if (SAFE_ACCESS(args, dart_entrypoint_argc, 0) > 0) {
2112 if (SAFE_ACCESS(args, dart_entrypoint_argv, nullptr) == nullptr) {
2114 "Could not determine Dart entrypoint arguments "
2115 "as dart_entrypoint_argc "
2116 "was set, but dart_entrypoint_argv was null.");
2117 }
2118 std::vector<std::string> arguments(args->dart_entrypoint_argc);
2119 for (int i = 0; i < args->dart_entrypoint_argc; ++i) {
2120 arguments[i] = std::string{args->dart_entrypoint_argv[i]};
2121 }
2122 run_configuration.SetEntrypointArgs(std::move(arguments));
2123 }
2124
2125 if (!run_configuration.IsValid()) {
2126 return LOG_EMBEDDER_ERROR(
2128 "Could not infer the Flutter project to run from given arguments.");
2129 }
2130
2131 // Create the engine but don't launch the shell or run the root isolate.
2132 auto embedder_engine = std::make_unique<flutter::EmbedderEngine>(
2133 std::move(thread_host), //
2134 std::move(task_runners), //
2135 std::move(settings), //
2136 std::move(run_configuration), //
2137 on_create_platform_view, //
2138 on_create_rasterizer, //
2139 std::move(external_texture_resolver) //
2140 );
2141
2142 // Release the ownership of the embedder engine to the caller.
2143 *engine_out = reinterpret_cast<FLUTTER_API_SYMBOL(FlutterEngine)>(
2144 embedder_engine.release());
2145 return kSuccess;
2146}
std::function< std::unique_ptr< FlutterOpenGLTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
std::function< std::unique_ptr< FlutterMetalExternalTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
static std::unique_ptr< EmbedderThreadHost > CreateEmbedderOrEngineManagedThreadHost(const FlutterCustomTaskRunners *custom_task_runners, const flutter::ThreadConfigSetter &config_setter=fml::Thread::SetCurrentThreadName)
static void SetCacheDirectoryPath(std::string path)
std::function< void()> OnPreEngineRestartCallback
std::function< void(std::unique_ptr< PlatformMessage >)> PlatformMessageResponseCallback
std::function< std::unique_ptr< std::vector< std::string > >(const std::vector< std::string > &supported_locale_data)> ComputePlatformResolvedLocaleCallback
std::function< void(const std::string &, bool)> ChanneUpdateCallback
std::function< void(flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions)> UpdateSemanticsCallback
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
std::function< std::unique_ptr< T >(Shell &)> CreateCallback
Definition shell.h:119
std::function< void(intptr_t)> VsyncCallback
void RemoveTaskObserver(intptr_t key)
void AddTaskObserver(intptr_t key, const fml::closure &callback)
@ kNormal
Default priority level.
@ kRaster
Suitable for thread which raster data.
@ kBackground
Suitable for threads that shouldn't disrupt high priority work.
@ kDisplay
Suitable for threads which generate data for the display.
static void SetCurrentThreadName(const ThreadConfig &config)
Definition thread.cc:135
static flutter::Shell::CreateCallback< flutter::PlatformView > InferPlatformViewCreationCallback(const FlutterRendererConfig *config, void *user_data, const flutter::PlatformViewEmbedder::PlatformDispatchTable &platform_dispatch_table, std::unique_ptr< flutter::EmbedderExternalViewEmbedder > external_view_embedder, bool enable_impeller)
Definition embedder.cc:707
static std::pair< std::unique_ptr< flutter::EmbedderExternalViewEmbedder >, bool > InferExternalViewEmbedderFromArgs(const FlutterCompositor *compositor, bool enable_impeller)
Definition embedder.cc:1279
static bool IsRendererValid(const FlutterRendererConfig *config)
Definition embedder.cc:226
flutter::PlatformViewEmbedder::UpdateSemanticsCallback CreateEmbedderSemanticsUpdateCallback(const FlutterProjectArgs *args, void *user_data)
Definition embedder.cc:1665
void PopulateJITSnapshotMappingCallbacks(const FlutterProjectArgs *args, flutter::Settings &settings)
Definition embedder.cc:1489
void PopulateAOTSnapshotMappingCallbacks(const FlutterProjectArgs *args, flutter::Settings &settings)
Definition embedder.cc:1532
#define FLUTTER_API_SYMBOL(symbol)
Definition embedder.h:67
struct _FlutterPlatformMessageResponseHandle FlutterPlatformMessageResponseHandle
Definition embedder.h:1157
void(* FlutterLogMessageCallback)(const char *, const char *, void *)
Definition embedder.h:2128
#define FLUTTER_ENGINE_VERSION
Definition embedder.h:70
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define FML_LOG(severity)
Definition logging.h:82
const char * name
Definition fuchsia.cc:50
static const char * kApplicationKernelSnapshotFileName
Win32Message message
FlTexture * texture
Settings SettingsFromCommandLine(const fml::CommandLine &command_line)
Definition switches.cc:228
std::string JoinPaths(std::initializer_list< std::string > components)
Definition paths.cc:14
CommandLine CommandLineFromArgcArgv(int argc, const char *const *argv)
std::function< void()> closure
Definition closure.h:14
int32_t height
int32_t width
An update to whether a message channel has a listener set or not.
Definition embedder.h:1533
FlutterMetalTextureFrameCallback external_texture_frame_callback
Definition embedder.h:702
TextureFrameCallback gl_external_texture_frame_callback
Definition embedder.h:557
const char * channel
Definition embedder.h:1163
FlutterMetalRendererConfig metal
Definition embedder.h:829
FlutterOpenGLRendererConfig open_gl
Definition embedder.h:827
FlutterRendererType type
Definition embedder.h:825
The ThreadConfig is the thread info include thread name, thread priority.
Definition thread.h:35

◆ FlutterEngineMarkExternalTextureFrameAvailable()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable ( FLUTTER_API_SYMBOL(FlutterEngine engine,
int64_t  texture_identifier 
)

Mark that a new texture frame is available for a given texture identifier.

See also
FlutterEngineRegisterExternalTexture()
FlutterEngineUnregisterExternalTexture()
Parameters
[in]engineA running engine instance.
[in]texture_identifierThe identifier of the texture whose frame has been updated.
Returns
The result of the call.

Definition at line 2803 of file embedder.cc.

2805 {
2806 if (engine == nullptr) {
2807 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2808 }
2809 if (texture_identifier == 0) {
2810 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid texture identifier.");
2811 }
2812 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)
2813 ->MarkTextureFrameAvailable(texture_identifier)) {
2814 return LOG_EMBEDDER_ERROR(
2816 "Could not mark the texture frame as being available.");
2817 }
2818 return kSuccess;
2819}

◆ FlutterEngineNotifyDisplayUpdate()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineNotifyDisplayUpdate ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterEngineDisplaysUpdateType  update_type,
const FlutterEngineDisplay displays,
size_t  display_count 
)

Posts updates corresponding to display changes to a running engine instance.

Parameters
[in]update_typeThe type of update pushed to the engine.
[in]displaysThe displays affected by this update.
[in]display_countSize of the displays array, must be at least 1.
Returns
the result of the call made to the engine.

Definition at line 3246 of file embedder.cc.

3250 {
3251 if (raw_engine == nullptr) {
3252 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3253 }
3254
3255 if (!ValidDisplayConfiguration(embedder_displays, display_count)) {
3256 return LOG_EMBEDDER_ERROR(
3258 "Invalid FlutterEngineDisplay configuration specified.");
3259 }
3260
3261 auto engine = reinterpret_cast<flutter::EmbedderEngine*>(raw_engine);
3262
3263 switch (update_type) {
3265 std::vector<std::unique_ptr<flutter::Display>> displays;
3266 const auto* display = embedder_displays;
3267 for (size_t i = 0; i < display_count; i++) {
3268 displays.push_back(std::make_unique<flutter::Display>(
3269 SAFE_ACCESS(display, display_id, i), //
3270 SAFE_ACCESS(display, refresh_rate, 0), //
3271 SAFE_ACCESS(display, width, 0), //
3272 SAFE_ACCESS(display, height, 0), //
3273 SAFE_ACCESS(display, device_pixel_ratio, 1)));
3274 display = reinterpret_cast<const FlutterEngineDisplay*>(
3275 reinterpret_cast<const uint8_t*>(display) + display->struct_size);
3276 }
3277 engine->GetShell().OnDisplayUpdates(std::move(displays));
3278 return kSuccess;
3279 }
3280 default:
3281 return LOG_EMBEDDER_ERROR(
3283 "Invalid FlutterEngineDisplaysUpdateType type specified.");
3284 }
3285}

◆ FlutterEngineNotifyLowMemoryWarning()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineNotifyLowMemoryWarning ( FLUTTER_API_SYMBOL(FlutterEngine engine)

Posts a low memory notification to a running engine instance. The engine will do its best to release non-critical resources in response. It is not guaranteed that the resource would have been collected by the time this call returns however. The notification is posted to engine subsystems that may be operating on other threads.

Flutter applications can respond to these notifications by setting WidgetsBindingObserver.didHaveMemoryPressure observers.

Parameters
[in]engineA running engine instance.
Returns
If the low memory notification was sent to the running engine instance.

Definition at line 3185 of file embedder.cc.

3186 {
3187 auto engine = reinterpret_cast<flutter::EmbedderEngine*>(raw_engine);
3188 if (engine == nullptr || !engine->IsValid()) {
3189 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine was invalid.");
3190 }
3191
3192 engine->GetShell().NotifyLowMemoryWarning();
3193
3194 rapidjson::Document document;
3195 auto& allocator = document.GetAllocator();
3196
3197 document.SetObject();
3198 document.AddMember("type", "memoryPressure", allocator);
3199
3200 return DispatchJSONPlatformMessage(raw_engine, document, "flutter/system")
3201 ? kSuccess
3204 "Could not dispatch the low memory notification message.");
3205}
static bool DispatchJSONPlatformMessage(FLUTTER_API_SYMBOL(FlutterEngine) engine, const rapidjson::Document &document, const std::string &channel_name)
Definition embedder.cc:2966

◆ FlutterEngineOnVsync()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync ( FLUTTER_API_SYMBOL(FlutterEngine engine,
intptr_t  baton,
uint64_t  frame_start_time_nanos,
uint64_t  frame_target_time_nanos 
)

Notify the engine that a vsync event occurred. A baton passed to the platform via the vsync callback must be returned. This call must be made on the thread on which the call to FlutterEngineRun was made.

See also
FlutterEngineGetCurrentTime()
Attention
That frame timepoints are in nanoseconds.
The system monotonic clock is used as the timebase.
Parameters
[in]engine.A running engine instance.
[in]batonThe baton supplied by the engine.
[in]frame_start_time_nanosThe point at which the vsync event occurred or will occur. If the time point is in the future, the engine will wait till that point to begin its frame workload.
[in]frame_target_time_nanosThe point at which the embedder anticipates the next vsync to occur. This is a hint the engine uses to schedule Dart VM garbage collection in periods in which the various threads are most likely to be idle. For example, for a 60Hz display, embedders should add 16.6 * 1e6 to the frame time field.
Returns
The result of the call.

Definition at line 2869 of file embedder.cc.

2873 {
2874 if (engine == nullptr) {
2875 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2876 }
2877
2878 TRACE_EVENT0("flutter", "FlutterEngineOnVsync");
2879
2880 auto start_time = fml::TimePoint::FromEpochDelta(
2881 fml::TimeDelta::FromNanoseconds(frame_start_time_nanos));
2882
2883 auto target_time = fml::TimePoint::FromEpochDelta(
2884 fml::TimeDelta::FromNanoseconds(frame_target_time_nanos));
2885
2886 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)->OnVsyncEvent(
2887 baton, start_time, target_time)) {
2888 return LOG_EMBEDDER_ERROR(
2890 "Could not notify the running engine instance of a Vsync event.");
2891 }
2892
2893 return kSuccess;
2894}
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition time_delta.h:40
static constexpr TimePoint FromEpochDelta(TimeDelta ticks)
Definition time_point.h:43
#define TRACE_EVENT0(category_group, name)

◆ FlutterEnginePostCallbackOnAllNativeThreads()

FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostCallbackOnAllNativeThreads ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterNativeThreadCallback  callback,
void *  user_data 
)

Schedule a callback to be run on all engine managed threads. The engine will attempt to service this callback the next time the message loop for each managed thread is idle. Since the engine manages the entire lifecycle of multiple threads, there is no opportunity for the embedders to finely tune the priorities of threads directly, or, perform other thread specific configuration (for example, setting thread names for tracing). This callback gives embedders a chance to affect such tuning.

Attention
This call is expensive and must be made as few times as possible. The callback must also return immediately as not doing so may risk performance issues (especially for callbacks of type kFlutterNativeThreadTypeUI and kFlutterNativeThreadTypeRender).
Some callbacks (especially the ones of type kFlutterNativeThreadTypeWorker) may be called after the FlutterEngine instance has shut down. Embedders must be careful in handling the lifecycle of objects associated with the user data baton.
In case there are multiple running Flutter engine instances, their workers are shared.
Parameters
[in]engineA running engine instance.
[in]callbackThe callback that will get called multiple times on each engine managed thread.
[in]user_dataA baton passed by the engine to the callback. This baton is not interpreted by the engine in any way.
Returns
Returns if the callback was successfully posted to all threads.

Definition at line 3207 of file embedder.cc.

3210 {
3211 if (engine == nullptr) {
3212 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3213 }
3214
3215 if (callback == nullptr) {
3217 "Invalid native thread callback.");
3218 }
3219
3220 return reinterpret_cast<flutter::EmbedderEngine*>(engine)
3221 ->PostTaskOnEngineManagedNativeThreads(
3224 })
3225 ? kSuccess
3227 "Internal error while attempting to post "
3228 "tasks to all threads.");
3229}

◆ FlutterEnginePostDartObject()

FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostDartObject ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterEngineDartPort  port,
const FlutterEngineDartObject object 
)

Posts a Dart object to specified send port. The corresponding receive port for send port can be in any isolate running in the VM. This isolate can also be the root isolate for an unrelated engine. The engine parameter is necessary only to ensure the call is not made when no engine (and hence no VM) is running.

Unlike the platform messages mechanism, there are no threading restrictions when using this API. Message can be posted on any thread and they will be made available to isolate on which the corresponding send port is listening.

However, it is the embedders responsibility to ensure that the call is not made during an ongoing call the FlutterEngineDeinitialize or FlutterEngineShutdown on another thread.

Parameters
[in]engineA running engine instance.
[in]portThe send port to send the object to.
[in]objectThe object to send to the isolate with the corresponding receive port.
Returns
If the message was posted to the send port.

Definition at line 3061 of file embedder.cc.

3064 {
3065 if (engine == nullptr) {
3066 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3067 }
3068
3069 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)->IsValid()) {
3070 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine not running.");
3071 }
3072
3073 if (port == ILLEGAL_PORT) {
3075 "Attempted to post to an illegal port.");
3076 }
3077
3078 if (object == nullptr) {
3080 "Invalid Dart object to post.");
3081 }
3082
3083 Dart_CObject dart_object = {};
3084 fml::ScopedCleanupClosure typed_data_finalizer;
3085
3086 switch (object->type) {
3088 dart_object.type = Dart_CObject_kNull;
3089 break;
3091 dart_object.type = Dart_CObject_kBool;
3092 dart_object.value.as_bool = object->bool_value;
3093 break;
3095 dart_object.type = Dart_CObject_kInt32;
3096 dart_object.value.as_int32 = object->int32_value;
3097 break;
3099 dart_object.type = Dart_CObject_kInt64;
3100 dart_object.value.as_int64 = object->int64_value;
3101 break;
3103 dart_object.type = Dart_CObject_kDouble;
3104 dart_object.value.as_double = object->double_value;
3105 break;
3107 if (object->string_value == nullptr) {
3109 "kFlutterEngineDartObjectTypeString must be "
3110 "a null terminated string but was null.");
3111 }
3112 dart_object.type = Dart_CObject_kString;
3113 dart_object.value.as_string = const_cast<char*>(object->string_value);
3114 break;
3116 auto* buffer = SAFE_ACCESS(object->buffer_value, buffer, nullptr);
3117 if (buffer == nullptr) {
3119 "kFlutterEngineDartObjectTypeBuffer must "
3120 "specify a buffer but found nullptr.");
3121 }
3122 auto buffer_size = SAFE_ACCESS(object->buffer_value, buffer_size, 0);
3123 auto callback =
3124 SAFE_ACCESS(object->buffer_value, buffer_collect_callback, nullptr);
3125 auto user_data = SAFE_ACCESS(object->buffer_value, user_data, nullptr);
3126
3127 // The user has provided a callback, let them manage the lifecycle of
3128 // the underlying data. If not, copy it out from the provided buffer.
3129
3130 if (callback == nullptr) {
3131 dart_object.type = Dart_CObject_kTypedData;
3133 dart_object.value.as_typed_data.length = buffer_size;
3134 dart_object.value.as_typed_data.values = buffer;
3135 } else {
3136 struct ExternalTypedDataPeer {
3137 void* user_data = nullptr;
3138 VoidCallback trampoline = nullptr;
3139 };
3140 auto peer = new ExternalTypedDataPeer();
3141 peer->user_data = user_data;
3142 peer->trampoline = callback;
3143 // This finalizer is set so that in case of failure of the
3144 // Dart_PostCObject below, we collect the peer. The embedder is still
3145 // responsible for collecting the buffer in case of non-kSuccess
3146 // returns from this method. This finalizer must be released in case
3147 // of kSuccess returns from this method.
3148 typed_data_finalizer.SetClosure([peer]() {
3149 // This is the tiny object we use as the peer to the Dart call so
3150 // that we can attach the a trampoline to the embedder supplied
3151 // callback. In case of error, we need to collect this object lest
3152 // we introduce a tiny leak.
3153 delete peer;
3154 });
3159 dart_object.value.as_external_typed_data.peer = peer;
3161 +[](void* unused_isolate_callback_data, void* peer) {
3162 auto typed_peer = reinterpret_cast<ExternalTypedDataPeer*>(peer);
3163 typed_peer->trampoline(typed_peer->user_data);
3164 delete typed_peer;
3165 };
3166 }
3167 } break;
3168 default:
3169 return LOG_EMBEDDER_ERROR(
3171 "Invalid FlutterEngineDartObjectType type specified.");
3172 }
3173
3174 if (!Dart_PostCObject(port, &dart_object)) {
3176 "Could not post the object to the Dart VM.");
3177 }
3178
3179 // On a successful call, the VM takes ownership of and is responsible for
3180 // invoking the finalizer.
3181 typed_data_finalizer.Release();
3182 return kSuccess;
3183}
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
fml::closure SetClosure(const fml::closure &closure)
Definition closure.h:54
fml::closure Release()
Definition closure.h:60
#define ILLEGAL_PORT
Definition dart_api.h:1530
@ Dart_TypedData_kUint8
Definition dart_api.h:2606
@ Dart_CObject_kInt64
@ Dart_CObject_kDouble
@ Dart_CObject_kTypedData
@ Dart_CObject_kString
@ Dart_CObject_kNull
@ Dart_CObject_kExternalTypedData
@ Dart_CObject_kInt32
@ Dart_CObject_kBool
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
static const uint8_t buffer[]
FlutterEngineDartObjectType type
Definition embedder.h:2067
const char * string_value
Definition embedder.h:2076
const FlutterEngineDartBuffer * buffer_value
Definition embedder.h:2077
Dart_HandleFinalizer callback
union _Dart_CObject::@86 value
Dart_CObject_Type type
struct _Dart_CObject::@86::@90 as_typed_data
const char * as_string
struct _Dart_CObject::@86::@91 as_external_typed_data
struct _Dart_CObject ** values

◆ FlutterEnginePostRenderThreadTask()

FLUTTER_EXPORT FlutterEngineResult FlutterEnginePostRenderThreadTask ( FLUTTER_API_SYMBOL(FlutterEngine engine,
VoidCallback  callback,
void *  callback_data 
)

Posts a task onto the Flutter render thread. Typically, this may be called from any thread as long as a FlutterEngineShutdown on the specific engine has not already been initiated.

Parameters
[in]engineA running engine instance.
[in]callbackThe callback to execute on the render thread.
callback_dataThe callback context.
Returns
The result of the call.

Definition at line 2927 of file embedder.cc.

2930 {
2931 if (engine == nullptr) {
2932 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2933 }
2934
2935 if (callback == nullptr) {
2937 "Render thread callback was null.");
2938 }
2939
2940 auto task = [callback, baton]() { callback(baton); };
2941
2942 return reinterpret_cast<flutter::EmbedderEngine*>(engine)
2943 ->PostRenderThreadTask(task)
2944 ? kSuccess
2946 "Could not post the render thread task.");
2947}

◆ FlutterEngineRegisterExternalTexture()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineRegisterExternalTexture ( FLUTTER_API_SYMBOL(FlutterEngine engine,
int64_t  texture_identifier 
)

Register an external texture with a unique (per engine) identifier. Only rendering backends that support external textures accept external texture registrations. After the external texture is registered, the application can mark that a frame is available by calling FlutterEngineMarkExternalTextureFrameAvailable.

See also
FlutterEngineUnregisterExternalTexture()
FlutterEngineMarkExternalTextureFrameAvailable()
Parameters
[in]engineA running engine instance.
[in]texture_identifierThe identifier of the texture to register with the engine. The embedder may supply new frames to this texture using the same identifier.
Returns
The result of the call.

Definition at line 2763 of file embedder.cc.

2765 {
2766 if (engine == nullptr) {
2767 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2768 }
2769
2770 if (texture_identifier == 0) {
2772 "Texture identifier was invalid.");
2773 }
2774 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)->RegisterTexture(
2775 texture_identifier)) {
2777 "Could not register the specified texture.");
2778 }
2779 return kSuccess;
2780}

◆ FlutterEngineReloadSystemFonts()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineReloadSystemFonts ( FLUTTER_API_SYMBOL(FlutterEngine engine)

Reloads the system fonts in engine.

Parameters
[in]engine.A running engine instance.
Returns
The result of the call.

Definition at line 2896 of file embedder.cc.

2897 {
2898 if (engine == nullptr) {
2899 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2900 }
2901
2902 TRACE_EVENT0("flutter", "FlutterEngineReloadSystemFonts");
2903
2904 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)
2905 ->ReloadSystemFonts()) {
2907 "Could not reload system fonts.");
2908 }
2909
2910 return kSuccess;
2911}

◆ FlutterEngineRemoveView()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineRemoveView ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterRemoveViewInfo info 
)

Removes a view.

        This is an asynchronous operation. The view's resources must not
        be cleaned up until |info.remove_view_callback| is invoked with
        a |removed| value of true.

        The callback is invoked on a thread managed by the engine. The
        embedder should re-thread if needed.

        Attempting to remove the implicit view will fail and will return
        kInvalidArguments. Attempting to remove a view with a
        non-existent view ID will fail, and |info.remove_view_callback|
        will be invoked with a |removed| value of false.
Parameters
[in]engineA running engine instance.
[in]infoThe remove view arguments. This can be deallocated once |FlutterEngineRemoveView| returns, before |remove_view_callback| is invoked.
Returns
The result of starting the asynchronous operation. If kSuccess, the |remove_view_callback| will be invoked.

Definition at line 2248 of file embedder.cc.

2250 {
2251 if (!engine) {
2252 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2253 }
2254 if (!info || !info->remove_view_callback) {
2256 "Remove view info handle was invalid.");
2257 }
2258
2259 if (info->view_id == kFlutterImplicitViewId) {
2260 return LOG_EMBEDDER_ERROR(
2262 "Remove view info was invalid. The implicit view cannot be removed.");
2263 }
2264
2265 // TODO(loicsharma): Return an error if the engine was initialized with
2266 // callbacks that are incompatible with multiple views.
2267 // https://github.com/flutter/flutter/issues/144806
2268
2269 // The engine must be running to remove a view.
2270 auto embedder_engine = reinterpret_cast<flutter::EmbedderEngine*>(engine);
2271 if (!embedder_engine->IsValid()) {
2272 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2273 }
2274
2276 [c_callback = info->remove_view_callback,
2277 user_data = info->user_data](bool removed) {
2280 result.removed = removed;
2281 result.user_data = user_data;
2282 c_callback(&result);
2283 };
2284
2285 embedder_engine->GetShell().GetPlatformView()->RemoveView(info->view_id,
2286 callback);
2287 return kSuccess;
2288}
std::function< void(bool removed)> RemoveViewCallback

◆ FlutterEngineRun()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineRun ( size_t  version,
const FlutterRendererConfig config,
const FlutterProjectArgs args,
void *  user_data,
FLUTTER_API_SYMBOL(FlutterEngine) *  engine_out 
)

Initialize and run a Flutter engine instance and return a handle to it. This is a convenience method for the pair of calls to FlutterEngineInitialize and FlutterEngineRunInitialized.

Note
This method of running a Flutter engine works well except in cases where the embedder specifies custom task runners via FlutterProjectArgs::custom_task_runners. In such cases, the engine may need the embedder to post tasks back to it before FlutterEngineRun has returned. Embedders can only post tasks to the engine if they have a handle to the engine. In such cases, embedders are advised to get the engine handle via the FlutterInitializeCall. Then they can call FlutterEngineRunInitialized knowing that they will be able to service custom tasks on other threads with the engine handle.
Parameters
[in]versionThe Flutter embedder API version. Must be FLUTTER_ENGINE_VERSION.
[in]configThe renderer configuration.
[in]argsThe Flutter project arguments.
user_dataA user data baton passed back to embedders in callbacks.
[out]engine_outThe engine handle on successful engine creation.
Returns
The result of the call to run the Flutter engine.

Definition at line 1711 of file embedder.cc.

1716 {
1717 auto result =
1718 FlutterEngineInitialize(version, config, args, user_data, engine_out);
1719
1720 if (result != kSuccess) {
1721 return result;
1722 }
1723
1724 return FlutterEngineRunInitialized(*engine_out);
1725}

◆ FlutterEngineRunInitialized()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineRunInitialized ( FLUTTER_API_SYMBOL(FlutterEngine engine)

Runs an initialized engine instance. An engine can be initialized via FlutterEngineInitialize. An initialized instance can only be run once. During and after this call, custom task runners supplied by the embedder are expected to start servicing tasks.

Parameters
[in]engineAn initialized engine instance that has not previously been run.
Returns
The result of the call to run the initialized Flutter engine instance.

Definition at line 2148 of file embedder.cc.

2149 {
2150 if (!engine) {
2151 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2152 }
2153
2154 auto embedder_engine = reinterpret_cast<flutter::EmbedderEngine*>(engine);
2155
2156 // The engine must not already be running. Initialize may only be called
2157 // once on an engine instance.
2158 if (embedder_engine->IsValid()) {
2159 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2160 }
2161
2162 // Step 1: Launch the shell.
2163 if (!embedder_engine->LaunchShell()) {
2165 "Could not launch the engine using supplied "
2166 "initialization arguments.");
2167 }
2168
2169 // Step 2: Tell the platform view to initialize itself.
2170 if (!embedder_engine->NotifyCreated()) {
2172 "Could not create platform view components.");
2173 }
2174
2175 // Step 3: Launch the root isolate.
2176 if (!embedder_engine->RunRootIsolate()) {
2177 return LOG_EMBEDDER_ERROR(
2179 "Could not run the root isolate of the Flutter application using the "
2180 "project arguments specified.");
2181 }
2182
2183 return kSuccess;
2184}

◆ FlutterEngineRunsAOTCompiledDartCode()

FLUTTER_EXPORT bool FlutterEngineRunsAOTCompiledDartCode ( void  )

Returns if the Flutter engine instance will run AOT compiled Dart code. This call has no threading restrictions.

For embedder code that is configured for both AOT and JIT mode Dart execution based on the Flutter engine being linked to, this runtime check may be used to appropriately configure the FlutterProjectArgs. In JIT mode execution, the kernel snapshots must be present in the Flutter assets directory specified in the FlutterProjectArgs. For AOT execution, the fields vm_snapshot_data, vm_snapshot_instructions, isolate_snapshot_data and isolate_snapshot_instructions (along with their size fields) must be specified in FlutterProjectArgs.

Returns
True, if AOT Dart code is run. JIT otherwise.

Definition at line 3057 of file embedder.cc.

3057 {
3059}

◆ FlutterEngineRunTask()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineRunTask ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterTask task 
)

Inform the engine to run the specified task. This task has been given to the engine via the FlutterTaskRunnerDescription.post_task_callback. This call must only be made at the target time specified in that callback. Running the task before that time is undefined behavior.

Parameters
[in]engineA running engine instance.
[in]taskthe task handle.
Returns
The result of the call.

Definition at line 2953 of file embedder.cc.

2955 {
2956 if (engine == nullptr) {
2957 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2958 }
2959
2960 return reinterpret_cast<flutter::EmbedderEngine*>(engine)->RunTask(task)
2961 ? kSuccess
2963 "Could not run the specified task.");
2964}

◆ FlutterEngineScheduleFrame()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineScheduleFrame ( FLUTTER_API_SYMBOL(FlutterEngine engine)

Schedule a new frame to redraw the content.

Parameters
[in]engineA running engine instance.
Returns
the result of the call made to the engine.

Definition at line 3287 of file embedder.cc.

3288 {
3289 if (engine == nullptr) {
3290 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3291 }
3292
3293 return reinterpret_cast<flutter::EmbedderEngine*>(engine)->ScheduleFrame()
3294 ? kSuccess
3296 "Could not schedule frame.");
3297}

◆ FlutterEngineSendKeyEvent()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendKeyEvent ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterKeyEvent event,
FlutterKeyEventCallback  callback,
void *  user_data 
)

Sends a key event to the engine. The framework will decide whether to handle this event in a synchronous fashion, although due to technical limitation, the result is always reported asynchronously. The callback is guaranteed to be called exactly once.

Parameters
[in]engineA running engine instance.
[in]eventThe event data to be sent. This function will no longer access event after returning.
[in]callbackThe callback invoked by the engine when the Flutter application has decided whether it handles this event. Accepts nullptr.
[in]user_dataThe context associated with the callback. The exact same value will used to invoke callback. Accepts nullptr.
Returns
The result of the call.

Definition at line 2575 of file embedder.cc.

2579 {
2580 if (engine == nullptr) {
2581 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2582 }
2583
2584 if (event == nullptr) {
2585 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid key event.");
2586 }
2587
2588 const char* character = SAFE_ACCESS(event, character, nullptr);
2589
2590 flutter::KeyData key_data;
2591 key_data.Clear();
2592 key_data.timestamp = static_cast<uint64_t>(SAFE_ACCESS(event, timestamp, 0));
2593 key_data.type = MapKeyEventType(
2595 key_data.physical = SAFE_ACCESS(event, physical, 0);
2596 key_data.logical = SAFE_ACCESS(event, logical, 0);
2597 key_data.synthesized = SAFE_ACCESS(event, synthesized, false);
2599 event, device_type,
2601
2602 auto packet = std::make_unique<flutter::KeyDataPacket>(key_data, character);
2603
2604 struct MessageData {
2606 void* user_data;
2607 };
2608
2609 MessageData* message_data =
2610 new MessageData{.callback = callback, .user_data = user_data};
2611
2613 engine, kFlutterKeyDataChannel, packet->data().data(),
2614 packet->data().size(),
2615 [](const uint8_t* data, size_t size, void* user_data) {
2616 auto message_data = std::unique_ptr<MessageData>(
2617 reinterpret_cast<MessageData*>(user_data));
2618 if (message_data->callback == nullptr) {
2619 return;
2620 }
2621 bool handled = false;
2622 if (size == 1) {
2623 handled = *data != 0;
2624 }
2625 message_data->callback(handled, message_data->user_data);
2626 },
2627 message_data);
2628}
static FlutterEngineResult InternalSendPlatformMessage(FLUTTER_API_SYMBOL(FlutterEngine) engine, const char *channel, const uint8_t *data, size_t size, FlutterDataCallback data_callback, void *user_data)
Definition embedder.cc:2539
static flutter::KeyEventDeviceType MapKeyEventDeviceType(FlutterKeyEventDeviceType event_kind)
Definition embedder.cc:2519
static flutter::KeyEventType MapKeyEventType(FlutterKeyEventType event_kind)
Definition embedder.cc:2506
const char * kFlutterKeyDataChannel
Definition embedder.cc:129
void(* FlutterKeyEventCallback)(bool, void *)
Definition embedder.h:1153
FlKeyEvent * event
uint64_t synthesized
Definition key_data.h:70
KeyEventDeviceType device_type
Definition key_data.h:71
uint64_t logical
Definition key_data.h:66
uint64_t physical
Definition key_data.h:65
KeyEventType type
Definition key_data.h:64
uint64_t timestamp
Definition key_data.h:63

◆ FlutterEngineSendPlatformMessage()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPlatformMessage ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterPlatformMessage message 
)

Definition at line 2630 of file embedder.cc.

2632 {
2633 if (engine == nullptr) {
2634 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2635 }
2636
2637 if (flutter_message == nullptr) {
2638 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid message argument.");
2639 }
2640
2641 if (SAFE_ACCESS(flutter_message, channel, nullptr) == nullptr) {
2642 return LOG_EMBEDDER_ERROR(
2643 kInvalidArguments, "Message argument did not specify a valid channel.");
2644 }
2645
2646 size_t message_size = SAFE_ACCESS(flutter_message, message_size, 0);
2647 const uint8_t* message_data = SAFE_ACCESS(flutter_message, message, nullptr);
2648
2649 if (message_size != 0 && message_data == nullptr) {
2650 return LOG_EMBEDDER_ERROR(
2652 "Message size was non-zero but the message data was nullptr.");
2653 }
2654
2655 const FlutterPlatformMessageResponseHandle* response_handle =
2656 SAFE_ACCESS(flutter_message, response_handle, nullptr);
2657
2659 if (response_handle && response_handle->message) {
2660 response = response_handle->message->response();
2661 }
2662
2663 std::unique_ptr<flutter::PlatformMessage> message;
2664 if (message_size == 0) {
2665 message = std::make_unique<flutter::PlatformMessage>(
2666 flutter_message->channel, response);
2667 } else {
2668 message = std::make_unique<flutter::PlatformMessage>(
2669 flutter_message->channel,
2670 fml::MallocMapping::Copy(message_data, message_size), response);
2671 }
2672
2673 return reinterpret_cast<flutter::EmbedderEngine*>(engine)
2674 ->SendPlatformMessage(std::move(message))
2675 ? kSuccess
2677 "Could not send a message to the running "
2678 "Flutter application.");
2679}
std::unique_ptr< flutter::PlatformMessage > message
Definition embedder.cc:1401

◆ FlutterEngineSendPlatformMessageResponse()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPlatformMessageResponse ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterPlatformMessageResponseHandle handle,
const uint8_t *  data,
size_t  data_length 
)

Send a response from the native side to a platform message from the Dart Flutter application.

Parameters
[in]engineThe running engine instance.
[in]handleThe platform message response handle.
[in]dataThe data to associate with the platform message response.
[in]data_lengthThe length of the platform message response data.
Returns
The result of the call.

Definition at line 2731 of file embedder.cc.

2735 {
2736 if (data_length != 0 && data == nullptr) {
2737 return LOG_EMBEDDER_ERROR(
2739 "Data size was non zero but the pointer to the data was null.");
2740 }
2741
2742 auto response = handle->message->response();
2743
2744 if (response) {
2745 if (data_length == 0) {
2746 response->CompleteEmpty();
2747 } else {
2748 response->Complete(std::make_unique<fml::DataMapping>(
2749 std::vector<uint8_t>({data, data + data_length})));
2750 }
2751 }
2752
2753 delete handle;
2754
2755 return kSuccess;
2756}

◆ FlutterEngineSendPointerEvent()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendPointerEvent ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterPointerEvent events,
size_t  events_count 
)

Definition at line 2423 of file embedder.cc.

2426 {
2427 if (engine == nullptr) {
2428 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2429 }
2430
2431 if (pointers == nullptr || events_count == 0) {
2432 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid pointer events.");
2433 }
2434
2435 auto packet = std::make_unique<flutter::PointerDataPacket>(events_count);
2436
2437 const FlutterPointerEvent* current = pointers;
2438
2439 for (size_t i = 0; i < events_count; ++i) {
2440 flutter::PointerData pointer_data;
2441 pointer_data.Clear();
2442 // this is currely in use only on android embedding.
2443 pointer_data.embedder_id = 0;
2444 pointer_data.time_stamp = SAFE_ACCESS(current, timestamp, 0);
2445 pointer_data.change = ToPointerDataChange(
2446 SAFE_ACCESS(current, phase, FlutterPointerPhase::kCancel));
2447 pointer_data.physical_x = SAFE_ACCESS(current, x, 0.0);
2448 pointer_data.physical_y = SAFE_ACCESS(current, y, 0.0);
2449 // Delta will be generated in pointer_data_packet_converter.cc.
2450 pointer_data.physical_delta_x = 0.0;
2451 pointer_data.physical_delta_y = 0.0;
2452 pointer_data.device = SAFE_ACCESS(current, device, 0);
2453 // Pointer identifier will be generated in
2454 // pointer_data_packet_converter.cc.
2455 pointer_data.pointer_identifier = 0;
2456 pointer_data.signal_kind = ToPointerDataSignalKind(
2457 SAFE_ACCESS(current, signal_kind, kFlutterPointerSignalKindNone));
2458 pointer_data.scroll_delta_x = SAFE_ACCESS(current, scroll_delta_x, 0.0);
2459 pointer_data.scroll_delta_y = SAFE_ACCESS(current, scroll_delta_y, 0.0);
2460 FlutterPointerDeviceKind device_kind =
2461 SAFE_ACCESS(current, device_kind, kFlutterPointerDeviceKindMouse);
2462 // For backwards compatibility with embedders written before the device
2463 // kind and buttons were exposed, if the device kind is not set treat it
2464 // as a mouse, with a synthesized primary button state based on the phase.
2465 if (device_kind == 0) {
2467 pointer_data.buttons =
2469
2470 } else {
2471 pointer_data.kind = ToPointerDataKind(device_kind);
2472 if (pointer_data.kind == flutter::PointerData::DeviceKind::kTouch) {
2473 // For touch events, set the button internally rather than requiring
2474 // it at the API level, since it's a confusing construction to expose.
2475 if (pointer_data.change == flutter::PointerData::Change::kDown ||
2478 }
2479 } else {
2480 // Buttons use the same mask values, so pass them through directly.
2481 pointer_data.buttons = SAFE_ACCESS(current, buttons, 0);
2482 }
2483 }
2484 pointer_data.pan_x = SAFE_ACCESS(current, pan_x, 0.0);
2485 pointer_data.pan_y = SAFE_ACCESS(current, pan_y, 0.0);
2486 // Delta will be generated in pointer_data_packet_converter.cc.
2487 pointer_data.pan_delta_x = 0.0;
2488 pointer_data.pan_delta_y = 0.0;
2489 pointer_data.scale = SAFE_ACCESS(current, scale, 0.0);
2490 pointer_data.rotation = SAFE_ACCESS(current, rotation, 0.0);
2491 pointer_data.view_id =
2492 SAFE_ACCESS(current, view_id, kFlutterImplicitViewId);
2493 packet->SetPointerData(i, pointer_data);
2494 current = reinterpret_cast<const FlutterPointerEvent*>(
2495 reinterpret_cast<const uint8_t*>(current) + current->struct_size);
2496 }
2497
2498 return reinterpret_cast<flutter::EmbedderEngine*>(engine)
2499 ->DispatchPointerDataPacket(std::move(packet))
2500 ? kSuccess
2502 "Could not dispatch pointer events to the "
2503 "running Flutter application.");
2504}
flutter::PointerData::SignalKind ToPointerDataSignalKind(FlutterPointerSignalKind kind)
Definition embedder.cc:2385
flutter::PointerData::DeviceKind ToPointerDataKind(FlutterPointerDeviceKind device_kind)
Definition embedder.cc:2368
flutter::PointerData::Change ToPointerDataChange(FlutterPointerPhase phase)
Definition embedder.cc:2339
int64_t PointerDataButtonsForLegacyEvent(flutter::PointerData::Change change)
Definition embedder.cc:2402
VkDevice device
Definition main.cc:53
double y
double x
@ kPointerButtonTouchContact
const Scalar scale
size_t struct_size
The size of this struct. Must be sizeof(FlutterPointerEvent).
Definition embedder.h:1034

◆ FlutterEngineSendWindowMetricsEvent()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSendWindowMetricsEvent ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterWindowMetricsEvent event 
)

Definition at line 2314 of file embedder.cc.

2316 {
2317 if (engine == nullptr || flutter_metrics == nullptr) {
2318 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2319 }
2320 FlutterViewId view_id =
2321 SAFE_ACCESS(flutter_metrics, view_id, kFlutterImplicitViewId);
2322
2323 std::variant<flutter::ViewportMetrics, std::string> metrics_or_error =
2324 MakeViewportMetricsFromWindowMetrics(flutter_metrics);
2325 if (const std::string* error = std::get_if<std::string>(&metrics_or_error)) {
2326 return LOG_EMBEDDER_ERROR(kInvalidArguments, error->c_str());
2327 }
2328
2329 auto metrics = std::get<flutter::ViewportMetrics>(metrics_or_error);
2330
2331 return reinterpret_cast<flutter::EmbedderEngine*>(engine)->SetViewportMetrics(
2332 view_id, metrics)
2333 ? kSuccess
2335 "Viewport metrics were invalid.");
2336}

◆ FlutterEngineSetNextFrameCallback()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineSetNextFrameCallback ( FLUTTER_API_SYMBOL(FlutterEngine engine,
VoidCallback  callback,
void *  user_data 
)

Schedule a callback to be called after the next frame is drawn. This must be called from the platform thread. The callback is executed only once from the raster thread; embedders must re-thread if necessary. Performing blocking calls in this callback may introduce application jank.

Parameters
[in]engineA running engine instance.
[in]callbackThe callback to execute.
[in]user_dataA baton passed by the engine to the callback. This baton is not interpreted by the engine in any way.
Returns
The result of the call.

Definition at line 3299 of file embedder.cc.

3302 {
3303 if (engine == nullptr) {
3304 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3305 }
3306
3307 if (callback == nullptr) {
3309 "Next frame callback was null.");
3310 }
3311
3312 flutter::EmbedderEngine* embedder_engine =
3313 reinterpret_cast<flutter::EmbedderEngine*>(engine);
3314
3315 fml::WeakPtr<flutter::PlatformView> weak_platform_view =
3316 embedder_engine->GetShell().GetPlatformView();
3317
3318 if (!weak_platform_view) {
3320 "Platform view unavailable.");
3321 }
3322
3323 weak_platform_view->SetNextFrameCallback(
3325
3326 return kSuccess;
3327}
fml::WeakPtr< PlatformView > GetPlatformView()
Platform views may only be accessed on the platform task runner.
Definition shell.cc:818

◆ FlutterEngineShutdown()

Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embedder API after this point. Making additional calls with this handle is undefined behavior.

Note
This de-initializes the Flutter engine instance (via an implicit call to FlutterEngineDeinitialize) if necessary.
Parameters
[in]engineThe Flutter engine instance to collect.
Returns
The result of the call to shutdown the Flutter engine instance.

Definition at line 2303 of file embedder.cc.

2304 {
2306 if (result != kSuccess) {
2307 return result;
2308 }
2309 auto embedder_engine = reinterpret_cast<flutter::EmbedderEngine*>(engine);
2310 delete embedder_engine;
2311 return kSuccess;
2312}

◆ FlutterEngineTraceEventDurationBegin()

FLUTTER_EXPORT void FlutterEngineTraceEventDurationBegin ( const char *  name)

A profiling utility. Logs a trace duration begin event to the timeline. If the timeline is unavailable or disabled, this has no effect. Must be balanced with an duration end event (via FlutterEngineTraceEventDurationEnd) with the same name on the same thread. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.

Parameters
[in]nameThe name of the trace event.

Definition at line 2913 of file embedder.cc.

2913 {
2914 fml::tracing::TraceEvent0("flutter", name, /*flow_id_count=*/0,
2915 /*flow_ids=*/nullptr);
2916}
void TraceEvent0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)

◆ FlutterEngineTraceEventDurationEnd()

FLUTTER_EXPORT void FlutterEngineTraceEventDurationEnd ( const char *  name)

A profiling utility. Logs a trace duration end event to the timeline. If the timeline is unavailable or disabled, this has no effect. This call must be preceded by a trace duration begin call (via FlutterEngineTraceEventDurationBegin) with the same name on the same thread. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.

Parameters
[in]nameThe name of the trace event.

Definition at line 2918 of file embedder.cc.

2918 {
2920}
void TraceEventEnd(TraceArg name)

◆ FlutterEngineTraceEventInstant()

FLUTTER_EXPORT void FlutterEngineTraceEventInstant ( const char *  name)

A profiling utility. Logs a trace duration instant event to the timeline. If the timeline is unavailable or disabled, this has no effect. Can be called on any thread. Strings passed into the function will NOT be copied when added to the timeline. Only string literals may be passed in.

Parameters
[in]nameThe name of the trace event.

Definition at line 2922 of file embedder.cc.

2922 {
2923 fml::tracing::TraceEventInstant0("flutter", name, /*flow_id_count=*/0,
2924 /*flow_ids=*/nullptr);
2925}
void TraceEventInstant0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)

◆ FlutterEngineUnregisterExternalTexture()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineUnregisterExternalTexture ( FLUTTER_API_SYMBOL(FlutterEngine engine,
int64_t  texture_identifier 
)

Unregister a previous texture registration.

See also
FlutterEngineRegisterExternalTexture()
FlutterEngineMarkExternalTextureFrameAvailable()
Parameters
[in]engineA running engine instance.
[in]texture_identifierThe identifier of the texture for which new frame will not be available.
Returns
The result of the call.

Definition at line 2782 of file embedder.cc.

2784 {
2785 if (engine == nullptr) {
2786 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2787 }
2788
2789 if (texture_identifier == 0) {
2791 "Texture identifier was invalid.");
2792 }
2793
2794 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)->UnregisterTexture(
2795 texture_identifier)) {
2797 "Could not un-register the specified texture.");
2798 }
2799
2800 return kSuccess;
2801}

◆ FlutterEngineUpdateAccessibilityFeatures()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterAccessibilityFeature  features 
)

Sets additional accessibility features.

Parameters
[in]engineA running engine instance
[in]featuresThe accessibility features to set.
Returns
The result of the call.

Definition at line 2835 of file embedder.cc.

2837 {
2838 if (engine == nullptr) {
2839 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2840 }
2841 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)
2842 ->SetAccessibilityFeatures(flags)) {
2844 "Could not update accessibility features.");
2845 }
2846 return kSuccess;
2847}
FlutterSemanticsFlag flags

◆ FlutterEngineUpdateLocales()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateLocales ( FLUTTER_API_SYMBOL(FlutterEngine engine,
const FlutterLocale **  locales,
size_t  locales_count 
)

Notify a running engine instance that the locale has been updated. The preferred locale must be the first item in the list of locales supplied. The other entries will be used as a fallback.

Parameters
[in]engineA running engine instance.
[in]localesThe updated locales in the order of preference.
[in]locales_countThe count of locales supplied.
Returns
Whether the locale updates were applied.

Definition at line 2998 of file embedder.cc.

3001 {
3002 if (engine == nullptr) {
3003 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
3004 }
3005
3006 if (locales_count == 0) {
3007 return kSuccess;
3008 }
3009
3010 if (locales == nullptr) {
3011 return LOG_EMBEDDER_ERROR(kInvalidArguments, "No locales were specified.");
3012 }
3013
3014 rapidjson::Document document;
3015 auto& allocator = document.GetAllocator();
3016
3017 document.SetObject();
3018 document.AddMember("method", "setLocale", allocator);
3019
3020 rapidjson::Value args(rapidjson::kArrayType);
3021 args.Reserve(locales_count * 4, allocator);
3022 for (size_t i = 0; i < locales_count; ++i) {
3023 const FlutterLocale* locale = locales[i];
3024 const char* language_code_str = SAFE_ACCESS(locale, language_code, nullptr);
3025 if (language_code_str == nullptr || ::strlen(language_code_str) == 0) {
3026 return LOG_EMBEDDER_ERROR(
3028 "Language code is required but not present in FlutterLocale.");
3029 }
3030
3031 const char* country_code_str = SAFE_ACCESS(locale, country_code, "");
3032 const char* script_code_str = SAFE_ACCESS(locale, script_code, "");
3033 const char* variant_code_str = SAFE_ACCESS(locale, variant_code, "");
3034
3035 rapidjson::Value language_code, country_code, script_code, variant_code;
3036
3037 language_code.SetString(language_code_str, allocator);
3038 country_code.SetString(country_code_str ? country_code_str : "", allocator);
3039 script_code.SetString(script_code_str ? script_code_str : "", allocator);
3040 variant_code.SetString(variant_code_str ? variant_code_str : "", allocator);
3041
3042 // Required.
3043 args.PushBack(language_code, allocator);
3044 args.PushBack(country_code, allocator);
3045 args.PushBack(script_code, allocator);
3046 args.PushBack(variant_code, allocator);
3047 }
3048 document.AddMember("args", args, allocator);
3049
3050 return DispatchJSONPlatformMessage(engine, document, "flutter/localization")
3051 ? kSuccess
3053 "Could not send message to update locale of "
3054 "a running Flutter application.");
3055}

◆ FlutterEngineUpdateSemanticsEnabled()

FLUTTER_EXPORT FlutterEngineResult FlutterEngineUpdateSemanticsEnabled ( FLUTTER_API_SYMBOL(FlutterEngine engine,
bool  enabled 
)

Enable or disable accessibility semantics.

Parameters
[in]engineA running engine instance.
[in]enabledWhen enabled, changes to the semantic contents of the window are sent via the FlutterUpdateSemanticsCallback2 registered to update_semantics_callback2 in FlutterProjectArgs.
Returns
The result of the call.

Definition at line 2821 of file embedder.cc.

2823 {
2824 if (engine == nullptr) {
2825 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2826 }
2827 if (!reinterpret_cast<flutter::EmbedderEngine*>(engine)->SetSemanticsEnabled(
2828 enabled)) {
2830 "Could not update semantics state.");
2831 }
2832 return kSuccess;
2833}

◆ FlutterPlatformMessageCreateResponseHandle()

FLUTTER_EXPORT FlutterEngineResult FlutterPlatformMessageCreateResponseHandle ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterDataCallback  data_callback,
void *  user_data,
FlutterPlatformMessageResponseHandle **  response_out 
)

Creates a platform message response handle that allows the embedder to set a native callback for a response to a message. This handle may be set on the response_handle field of any FlutterPlatformMessage sent to the engine.

The handle must be collected via a call to FlutterPlatformMessageReleaseResponseHandle. This may be done immediately after a call to FlutterEngineSendPlatformMessage with a platform message whose response handle contains the handle created using this call. In case a handle is created but never sent in a message, the release call must still be made. Not calling release on the handle results in a small memory leak.

The user data baton passed to the data callback is the one specified in this call as the third argument.

See also
FlutterPlatformMessageReleaseResponseHandle()
Parameters
[in]engineA running engine instance.
[in]data_callbackThe callback invoked by the engine when the Flutter application send a response on the handle.
[in]user_dataThe user data associated with the data callback.
[out]response_outThe response handle created when this call is successful.
Returns
The result of the call.

Definition at line 2681 of file embedder.cc.

2685 {
2686 if (engine == nullptr) {
2687 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Engine handle was invalid.");
2688 }
2689
2690 if (data_callback == nullptr || response_out == nullptr) {
2691 return LOG_EMBEDDER_ERROR(
2692 kInvalidArguments, "Data callback or the response handle was invalid.");
2693 }
2694
2696 [user_data, data_callback](const uint8_t* data, size_t size) {
2697 data_callback(data, size, user_data);
2698 };
2699
2700 auto platform_task_runner = reinterpret_cast<flutter::EmbedderEngine*>(engine)
2701 ->GetTaskRunners()
2702 .GetPlatformTaskRunner();
2703
2704 auto handle = new FlutterPlatformMessageResponseHandle();
2705
2706 handle->message = std::make_unique<flutter::PlatformMessage>(
2707 "", // The channel is empty and unused as the response handle is going
2708 // to referenced directly in the |FlutterEngineSendPlatformMessage|
2709 // with the container message discarded.
2710 fml::MakeRefCounted<flutter::EmbedderPlatformMessageResponse>(
2711 std::move(platform_task_runner), response_callback));
2712 *response_out = handle;
2713 return kSuccess;
2714}
std::function< void(const uint8_t *data, size_t size)> Callback
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ FlutterPlatformMessageReleaseResponseHandle()

FLUTTER_EXPORT FlutterEngineResult FlutterPlatformMessageReleaseResponseHandle ( FLUTTER_API_SYMBOL(FlutterEngine engine,
FlutterPlatformMessageResponseHandle response 
)

Collects the handle created using FlutterPlatformMessageCreateResponseHandle.

See also
FlutterPlatformMessageCreateResponseHandle()
Parameters
[in]engineA running engine instance.
[in]responseThe platform message response handle to collect. These handles are created using FlutterPlatformMessageCreateResponseHandle().
Returns
The result of the call.

Definition at line 2716 of file embedder.cc.

2718 {
2719 if (engine == nullptr) {
2720 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid engine handle.");
2721 }
2722
2723 if (response == nullptr) {
2724 return LOG_EMBEDDER_ERROR(kInvalidArguments, "Invalid response handle.");
2725 }
2726 delete response;
2727 return kSuccess;
2728}

Variable Documentation

◆ kFlutterSemanticsCustomActionIdBatchEnd

FLUTTER_EXPORT const int32_t kFlutterSemanticsCustomActionIdBatchEnd
extern

FlutterSemanticsCustomAction ID used as a sentinel to signal the end of a batch of semantics custom action updates. This is unused if using FlutterUpdateSemanticsCallback2.

Definition at line 105 of file embedder.cc.

◆ kFlutterSemanticsNodeIdBatchEnd

FLUTTER_EXPORT const int32_t kFlutterSemanticsNodeIdBatchEnd
extern

FlutterSemanticsNode ID used as a sentinel to signal the end of a batch of semantics node updates. This is unused if using FlutterUpdateSemanticsCallback2.

Definition at line 104 of file embedder.cc.