Flutter Engine
The Flutter Engine
Classes | Macros | Typedefs | Enumerations | Functions
dart_api.h File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  Dart_IsolateFlags
 
struct  Dart_CodeObserver
 
struct  Dart_InitializeParams
 
struct  Dart_PortEx
 
struct  _Dart_NativeArgument_Descriptor
 
union  _Dart_NativeArgument_Value
 
struct  NativeAssetsApi
 
struct  Dart_KernelCompilationResult
 
struct  Dart_SourceFile
 

Macros

#define __STDC_FORMAT_MACROS
 
#define DART_EXTERN_C   extern
 
#define DART_WARN_UNUSED_RESULT
 
#define DART_DEPRECATED(msg)
 
#define DART_FLAGS_CURRENT_VERSION   (0x0000000d)
 
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION   (0x00000008)
 
#define ILLEGAL_PORT   ((Dart_Port)0)
 
#define BITMASK(size)   ((1 << size) - 1)
 
#define DART_NATIVE_ARG_DESCRIPTOR(type, position)
 
#define DART_KERNEL_ISOLATE_NAME   "kernel-service"
 
#define DART_VM_SERVICE_ISOLATE_NAME   "vm-service"
 
#define kSnapshotBuildIdCSymbol   "_kDartSnapshotBuildId"
 
#define kVmSnapshotDataCSymbol   "_kDartVmSnapshotData"
 
#define kVmSnapshotInstructionsCSymbol   "_kDartVmSnapshotInstructions"
 
#define kVmSnapshotBssCSymbol   "_kDartVmSnapshotBss"
 
#define kIsolateSnapshotDataCSymbol   "_kDartIsolateSnapshotData"
 
#define kIsolateSnapshotInstructionsCSymbol   "_kDartIsolateSnapshotInstructions"
 
#define kIsolateSnapshotBssCSymbol   "_kDartIsolateSnapshotBss"
 
#define kSnapshotBuildIdAsmSymbol   "_kDartSnapshotBuildId"
 
#define kVmSnapshotDataAsmSymbol   "_kDartVmSnapshotData"
 
#define kVmSnapshotInstructionsAsmSymbol   "_kDartVmSnapshotInstructions"
 
#define kVmSnapshotBssAsmSymbol   "_kDartVmSnapshotBss"
 
#define kIsolateSnapshotDataAsmSymbol   "_kDartIsolateSnapshotData"
 
#define kIsolateSnapshotInstructionsAsmSymbol    "_kDartIsolateSnapshotInstructions"
 
#define kIsolateSnapshotBssAsmSymbol   "_kDartIsolateSnapshotBss"
 

Typedefs

typedef struct _Dart_Isolate * Dart_Isolate
 
typedef struct _Dart_IsolateGroup * Dart_IsolateGroup
 
typedef struct _Dart_Handle * Dart_Handle
 
typedef Dart_Handle Dart_PersistentHandle
 
typedef struct _Dart_WeakPersistentHandle * Dart_WeakPersistentHandle
 
typedef struct _Dart_FinalizableHandle * Dart_FinalizableHandle
 
typedef void(* Dart_HandleFinalizer) (void *isolate_callback_data, void *peer)
 
typedef Dart_Isolate(* Dart_IsolateGroupCreateCallback) (const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)
 
typedef bool(* Dart_InitializeIsolateCallback) (void **child_isolate_data, char **error)
 
typedef void(* Dart_IsolateShutdownCallback) (void *isolate_group_data, void *isolate_data)
 
typedef void(* Dart_IsolateCleanupCallback) (void *isolate_group_data, void *isolate_data)
 
typedef void(* Dart_IsolateGroupCleanupCallback) (void *isolate_group_data)
 
typedef void(* Dart_ThreadStartCallback) (void)
 
typedef void(* Dart_ThreadExitCallback) (void)
 
typedef void *(* Dart_FileOpenCallback) (const char *name, bool write)
 
typedef void(* Dart_FileReadCallback) (uint8_t **data, intptr_t *file_length, void *stream)
 
typedef void(* Dart_FileWriteCallback) (const void *data, intptr_t length, void *stream)
 
typedef void(* Dart_FileCloseCallback) (void *stream)
 
typedef bool(* Dart_EntropySource) (uint8_t *buffer, intptr_t length)
 
typedef Dart_Handle(* Dart_GetVMServiceAssetsArchive) (void)
 
typedef void(* Dart_OnNewCodeCallback) (struct Dart_CodeObserver *observer, const char *name, uintptr_t base, uintptr_t size)
 
typedef struct Dart_CodeObserver Dart_CodeObserver
 
typedef const char *(* Dart_RegisterKernelBlobCallback) (const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
typedef void(* Dart_UnregisterKernelBlobCallback) (const char *kernel_blob_uri)
 
typedef int64_t Dart_IsolateGroupId
 
typedef void(* Dart_HeapSamplingReportCallback) (void *context, void *data)
 
typedef void *(* Dart_HeapSamplingCreateCallback) (Dart_Isolate isolate, Dart_IsolateGroup isolate_group, const char *cls_name, intptr_t allocation_size)
 
typedef void(* Dart_HeapSamplingDeleteCallback) (void *data)
 
typedef int64_t Dart_Port
 
typedef void(* Dart_MessageNotifyCallback) (Dart_Isolate destination_isolate)
 
typedef struct _Dart_NativeArguments * Dart_NativeArguments
 
typedef struct _Dart_NativeArgument_Descriptor Dart_NativeArgument_Descriptor
 
typedef union _Dart_NativeArgument_Value Dart_NativeArgument_Value
 
typedef void(* Dart_NativeFunction) (Dart_NativeArguments arguments)
 
typedef Dart_NativeFunction(* Dart_NativeEntryResolver) (Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)
 
typedef const uint8_t *(* Dart_NativeEntrySymbol) (Dart_NativeFunction nf)
 
typedef void *(* Dart_FfiNativeResolver) (const char *name, uintptr_t args_n)
 
typedef Dart_Handle(* Dart_EnvironmentCallback) (Dart_Handle name)
 
typedef void *(* Dart_NativeAssetsDlopenCallback) (const char *path, char **error)
 
typedef void *(* Dart_NativeAssetsDlopenCallbackNoPath) (char **error)
 
typedef void *(* Dart_NativeAssetsDlsymCallback) (void *handle, const char *symbol, char **error)
 
typedef Dart_Handle(* Dart_LibraryTagHandler) (Dart_LibraryTag tag, Dart_Handle library_or_package_map_url, Dart_Handle url)
 
typedef Dart_Handle(* Dart_DeferredLoadHandler) (intptr_t loading_unit_id)
 
typedef void(* Dart_CreateLoadingUnitCallback) (void *callback_data, intptr_t loading_unit_id, void **write_callback_data, void **write_debug_callback_data)
 
typedef void(* Dart_StreamingWriteCallback) (void *callback_data, const uint8_t *buffer, intptr_t size)
 
typedef void(* Dart_StreamingCloseCallback) (void *callback_data)
 
typedef char *(* Dart_DwarfStackTraceFootnoteCallback) (void *addresses[], intptr_t count)
 

Enumerations

enum  Dart_PerformanceMode { Dart_PerformanceMode_Default , Dart_PerformanceMode_Latency , Dart_PerformanceMode_Throughput , Dart_PerformanceMode_Memory }
 
enum  Dart_TypedData_Type {
  Dart_TypedData_kByteData = 0 , Dart_TypedData_kInt8 , Dart_TypedData_kUint8 , Dart_TypedData_kUint8Clamped ,
  Dart_TypedData_kInt16 , Dart_TypedData_kUint16 , Dart_TypedData_kInt32 , Dart_TypedData_kUint32 ,
  Dart_TypedData_kInt64 , Dart_TypedData_kUint64 , Dart_TypedData_kFloat32 , Dart_TypedData_kFloat64 ,
  Dart_TypedData_kInt32x4 , Dart_TypedData_kFloat32x4 , Dart_TypedData_kFloat64x2 , Dart_TypedData_kInvalid
}
 
enum  Dart_NativeArgument_Type {
  Dart_NativeArgument_kBool = 0 , Dart_NativeArgument_kInt32 , Dart_NativeArgument_kUint32 , Dart_NativeArgument_kInt64 ,
  Dart_NativeArgument_kUint64 , Dart_NativeArgument_kDouble , Dart_NativeArgument_kString , Dart_NativeArgument_kInstance ,
  Dart_NativeArgument_kNativeFields
}
 
enum  { kNativeArgNumberPos = 0 , kNativeArgNumberSize = 8 , kNativeArgTypePos = kNativeArgNumberPos + kNativeArgNumberSize , kNativeArgTypeSize = 8 }
 
enum  Dart_LibraryTag { Dart_kCanonicalizeUrl = 0 , Dart_kImportTag , Dart_kKernelTag }
 
enum  Dart_KernelCompilationStatus {
  Dart_KernelCompilationStatus_Unknown = -1 , Dart_KernelCompilationStatus_Ok = 0 , Dart_KernelCompilationStatus_Error = 1 , Dart_KernelCompilationStatus_Crash = 2 ,
  Dart_KernelCompilationStatus_MsgFailed = 3
}
 
enum  Dart_KernelCompilationVerbosityLevel { Dart_KernelCompilationVerbosityLevel_Error = 0 , Dart_KernelCompilationVerbosityLevel_Warning , Dart_KernelCompilationVerbosityLevel_Info , Dart_KernelCompilationVerbosityLevel_All }
 

Functions

DART_EXPORT bool Dart_IsError (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsApiError (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsUnhandledExceptionError (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsCompilationError (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsFatalError (Dart_Handle handle)
 
DART_EXPORT const char * Dart_GetError (Dart_Handle handle)
 
DART_EXPORT bool Dart_ErrorHasException (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ErrorGetException (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_NewApiError (const char *error)
 
DART_EXPORT Dart_Handle Dart_NewCompilationError (const char *error)
 
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError (Dart_Handle exception)
 
DART_EXPORT void Dart_PropagateError (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ToString (Dart_Handle object)
 
DART_EXPORT bool Dart_IdentityEquals (Dart_Handle obj1, Dart_Handle obj2)
 
DART_EXPORT Dart_Handle Dart_HandleFromPersistent (Dart_PersistentHandle object)
 
DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent (Dart_WeakPersistentHandle object)
 
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle (Dart_Handle object)
 
DART_EXPORT void Dart_SetPersistentHandle (Dart_PersistentHandle obj1, Dart_Handle obj2)
 
DART_EXPORT void Dart_DeletePersistentHandle (Dart_PersistentHandle object)
 
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle (Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT void Dart_DeleteWeakPersistentHandle (Dart_WeakPersistentHandle object)
 
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle (Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT void Dart_DeleteFinalizableHandle (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)
 
DART_EXPORT const char * Dart_VersionString (void)
 
DART_EXPORT void Dart_IsolateFlagsInitialize (Dart_IsolateFlags *flags)
 
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Initialize (Dart_InitializeParams *params)
 
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Cleanup (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_SetVMFlags (int argc, const char **argv)
 
DART_EXPORT bool Dart_IsVMFlagSet (const char *flag_name)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup (const char *script_uri, const char *name, const uint8_t *isolate_snapshot_data, const uint8_t *isolate_snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateInGroup (Dart_Isolate group_member, const char *name, Dart_IsolateShutdownCallback shutdown_callback, Dart_IsolateCleanupCallback cleanup_callback, void *child_isolate_data, char **error)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel (const char *script_uri, const char *name, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
 
DART_EXPORT void Dart_ShutdownIsolate (void)
 
DART_EXPORT Dart_Isolate Dart_CurrentIsolate (void)
 
DART_EXPORT void * Dart_CurrentIsolateData (void)
 
DART_EXPORT void * Dart_IsolateData (Dart_Isolate isolate)
 
DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup (void)
 
DART_EXPORT void * Dart_CurrentIsolateGroupData (void)
 
DART_EXPORT Dart_IsolateGroupId Dart_CurrentIsolateGroupId (void)
 
DART_EXPORT void * Dart_IsolateGroupData (Dart_Isolate isolate)
 
DART_EXPORT Dart_Handle Dart_DebugName (void)
 
DART_EXPORT const char * Dart_DebugNameToCString (void)
 
DART_EXPORT const char * Dart_IsolateServiceId (Dart_Isolate isolate)
 
DART_EXPORT void Dart_EnterIsolate (Dart_Isolate isolate)
 
DART_EXPORT void Dart_KillIsolate (Dart_Isolate isolate)
 
DART_EXPORT void Dart_NotifyIdle (int64_t deadline)
 
DART_EXPORT void Dart_EnableHeapSampling (void)
 
DART_EXPORT void Dart_DisableHeapSampling (void)
 
DART_EXPORT void Dart_RegisterHeapSamplingCallback (Dart_HeapSamplingCreateCallback create_callback, Dart_HeapSamplingDeleteCallback delete_callback)
 
DART_EXPORT void Dart_ReportSurvivingAllocations (Dart_HeapSamplingReportCallback callback, void *context, bool force_gc)
 
DART_EXPORT void Dart_SetHeapSamplingPeriod (intptr_t bytes)
 
DART_EXPORT void Dart_NotifyDestroyed (void)
 
DART_EXPORT void Dart_NotifyLowMemory (void)
 
DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode (Dart_PerformanceMode mode)
 
DART_EXPORT void Dart_StartProfiling (void)
 
DART_EXPORT void Dart_StopProfiling (void)
 
DART_EXPORT void Dart_ThreadDisableProfiling (void)
 
DART_EXPORT void Dart_ThreadEnableProfiling (void)
 
DART_EXPORT void Dart_AddSymbols (const char *dso_name, void *buffer, intptr_t buffer_size)
 
DART_EXPORT void Dart_ExitIsolate (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateSnapshot (uint8_t **vm_snapshot_data_buffer, intptr_t *vm_snapshot_data_size, uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, bool is_core)
 
DART_EXPORT bool Dart_IsKernel (const uint8_t *buffer, intptr_t buffer_size)
 
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_IsolateMakeRunnable (Dart_Isolate isolate)
 
DART_EXPORT void Dart_SetMessageNotifyCallback (Dart_MessageNotifyCallback message_notify_callback)
 
DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback (void)
 
DART_EXPORT bool Dart_ShouldPauseOnStart (void)
 
DART_EXPORT void Dart_SetShouldPauseOnStart (bool should_pause)
 
DART_EXPORT bool Dart_IsPausedOnStart (void)
 
DART_EXPORT void Dart_SetPausedOnStart (bool paused)
 
DART_EXPORT bool Dart_ShouldPauseOnExit (void)
 
DART_EXPORT void Dart_SetShouldPauseOnExit (bool should_pause)
 
DART_EXPORT bool Dart_IsPausedOnExit (void)
 
DART_EXPORT void Dart_SetPausedOnExit (bool paused)
 
DART_EXPORT void Dart_SetStickyError (Dart_Handle error)
 
DART_EXPORT bool Dart_HasStickyError (void)
 
DART_EXPORT Dart_Handle Dart_GetStickyError (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_HandleMessage (void)
 
DART_EXPORT bool Dart_HandleServiceMessages (void)
 
DART_EXPORT bool Dart_HasServiceMessages (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_RunLoop (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT bool Dart_RunLoopAsync (bool errors_are_fatal, Dart_Port on_error_port, Dart_Port on_exit_port, char **error)
 
DART_EXPORT Dart_Port Dart_GetMainPortId (void)
 
DART_EXPORT bool Dart_HasLivePorts (void)
 
DART_EXPORT bool Dart_Post (Dart_Port port_id, Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_NewSendPort (Dart_Port port_id)
 
DART_EXPORT Dart_Handle Dart_NewSendPortEx (Dart_PortEx portex_id)
 
DART_EXPORT Dart_Handle Dart_SendPortGetId (Dart_Handle port, Dart_Port *port_id)
 
DART_EXPORT Dart_Handle Dart_SendPortGetIdEx (Dart_Handle port, Dart_PortEx *portex_id)
 
DART_EXPORT void Dart_EnterScope (void)
 
DART_EXPORT void Dart_ExitScope (void)
 
DART_EXPORT uint8_t * Dart_ScopeAllocate (intptr_t size)
 
DART_EXPORT Dart_Handle Dart_Null (void)
 
DART_EXPORT bool Dart_IsNull (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_EmptyString (void)
 
DART_EXPORT Dart_Handle Dart_TypeDynamic (void)
 
DART_EXPORT Dart_Handle Dart_TypeVoid (void)
 
DART_EXPORT Dart_Handle Dart_TypeNever (void)
 
DART_EXPORT Dart_Handle Dart_ObjectEquals (Dart_Handle obj1, Dart_Handle obj2, bool *equal)
 
DART_EXPORT Dart_Handle Dart_ObjectIsType (Dart_Handle object, Dart_Handle type, bool *instanceof)
 
DART_EXPORT bool Dart_IsInstance (Dart_Handle object)
 
DART_EXPORT bool Dart_IsNumber (Dart_Handle object)
 
DART_EXPORT bool Dart_IsInteger (Dart_Handle object)
 
DART_EXPORT bool Dart_IsDouble (Dart_Handle object)
 
DART_EXPORT bool Dart_IsBoolean (Dart_Handle object)
 
DART_EXPORT bool Dart_IsString (Dart_Handle object)
 
DART_EXPORT bool Dart_IsStringLatin1 (Dart_Handle object)
 
DART_EXPORT bool Dart_IsList (Dart_Handle object)
 
DART_EXPORT bool Dart_IsMap (Dart_Handle object)
 
DART_EXPORT bool Dart_IsLibrary (Dart_Handle object)
 
DART_EXPORT bool Dart_IsType (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsFunction (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsVariable (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsTypeVariable (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsClosure (Dart_Handle object)
 
DART_EXPORT bool Dart_IsTypedData (Dart_Handle object)
 
DART_EXPORT bool Dart_IsByteBuffer (Dart_Handle object)
 
DART_EXPORT bool Dart_IsFuture (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_InstanceGetType (Dart_Handle instance)
 
DART_EXPORT Dart_Handle Dart_ClassName (Dart_Handle cls_type)
 
DART_EXPORT Dart_Handle Dart_FunctionName (Dart_Handle function)
 
DART_EXPORT Dart_Handle Dart_FunctionOwner (Dart_Handle function)
 
DART_EXPORT Dart_Handle Dart_FunctionIsStatic (Dart_Handle function, bool *is_static)
 
DART_EXPORT bool Dart_IsTearOff (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_ClosureFunction (Dart_Handle closure)
 
DART_EXPORT Dart_Handle Dart_ClassLibrary (Dart_Handle cls_type)
 
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64 (Dart_Handle integer, bool *fits)
 
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64 (Dart_Handle integer, bool *fits)
 
DART_EXPORT Dart_Handle Dart_NewInteger (int64_t value)
 
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64 (uint64_t value)
 
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString (const char *value)
 
DART_EXPORT Dart_Handle Dart_IntegerToInt64 (Dart_Handle integer, int64_t *value)
 
DART_EXPORT Dart_Handle Dart_IntegerToUint64 (Dart_Handle integer, uint64_t *value)
 
DART_EXPORT Dart_Handle Dart_IntegerToHexCString (Dart_Handle integer, const char **value)
 
DART_EXPORT Dart_Handle Dart_NewDouble (double value)
 
DART_EXPORT Dart_Handle Dart_DoubleValue (Dart_Handle double_obj, double *value)
 
DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure (Dart_Handle library, Dart_Handle cls_type, Dart_Handle function_name)
 
DART_EXPORT Dart_Handle Dart_True (void)
 
DART_EXPORT Dart_Handle Dart_False (void)
 
DART_EXPORT Dart_Handle Dart_NewBoolean (bool value)
 
DART_EXPORT Dart_Handle Dart_BooleanValue (Dart_Handle boolean_obj, bool *value)
 
DART_EXPORT Dart_Handle Dart_StringLength (Dart_Handle str, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_StringUTF8Length (Dart_Handle str, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_NewStringFromCString (const char *str)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8 (const uint8_t *utf8_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF16 (const uint16_t *utf16_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF32 (const int32_t *utf32_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_StringToCString (Dart_Handle str, const char **cstr)
 
DART_EXPORT Dart_Handle Dart_StringToUTF8 (Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_CopyUTF8EncodingOfString (Dart_Handle str, uint8_t *utf8_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_StringToLatin1 (Dart_Handle str, uint8_t *latin1_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_StringToUTF16 (Dart_Handle str, uint16_t *utf16_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_StringStorageSize (Dart_Handle str, intptr_t *size)
 
DART_EXPORT Dart_Handle Dart_StringGetProperties (Dart_Handle str, intptr_t *char_size, intptr_t *str_len, void **peer)
 
DART_EXPORT Dart_Handle Dart_NewList (intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewListOfType (Dart_Handle element_type, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled (Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_ListLength (Dart_Handle list, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_ListGetAt (Dart_Handle list, intptr_t index)
 
DART_EXPORT Dart_Handle Dart_ListGetRange (Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
 
DART_EXPORT Dart_Handle Dart_ListSetAt (Dart_Handle list, intptr_t index, Dart_Handle value)
 
DART_EXPORT Dart_Handle Dart_ListGetAsBytes (Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_ListSetAsBytes (Dart_Handle list, intptr_t offset, const uint8_t *native_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_MapGetAt (Dart_Handle map, Dart_Handle key)
 
DART_EXPORT Dart_Handle Dart_MapContainsKey (Dart_Handle map, Dart_Handle key)
 
DART_EXPORT Dart_Handle Dart_MapKeys (Dart_Handle map)
 
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData (Dart_Handle object)
 
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_NewTypedData (Dart_TypedData_Type type, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewExternalTypedData (Dart_TypedData_Type type, void *data, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer (Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer (Dart_TypedData_Type type, const void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT Dart_Handle Dart_NewByteBuffer (Dart_Handle typed_data)
 
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData (Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
 
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer (Dart_Handle byte_buffer)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_New (Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Allocate (Dart_Handle type)
 
DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields (Dart_Handle type, intptr_t num_native_fields, const intptr_t *native_fields)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Invoke (Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeClosure (Dart_Handle closure, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeConstructor (Dart_Handle object, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField (Dart_Handle container, Dart_Handle name)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SetField (Dart_Handle container, Dart_Handle name, Dart_Handle value)
 
DART_EXPORT Dart_Handle Dart_ThrowException (Dart_Handle exception)
 
DART_EXPORT Dart_Handle Dart_ReThrowException (Dart_Handle exception, Dart_Handle stacktrace)
 
DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount (Dart_Handle obj, int *count)
 
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField (Dart_Handle obj, int index, intptr_t *value)
 
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField (Dart_Handle obj, int index, intptr_t value)
 
DART_EXPORT void * Dart_GetNativeIsolateGroupData (Dart_NativeArguments args)
 
DART_EXPORT Dart_Handle Dart_GetNativeArguments (Dart_NativeArguments args, int num_arguments, const Dart_NativeArgument_Descriptor *arg_descriptors, Dart_NativeArgument_Value *arg_values)
 
DART_EXPORT Dart_Handle Dart_GetNativeArgument (Dart_NativeArguments args, int index)
 
DART_EXPORT int Dart_GetNativeArgumentCount (Dart_NativeArguments args)
 
DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument (Dart_NativeArguments args, int arg_index, int num_fields, intptr_t *field_values)
 
DART_EXPORT Dart_Handle Dart_GetNativeReceiver (Dart_NativeArguments args, intptr_t *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeStringArgument (Dart_NativeArguments args, int arg_index, void **peer)
 
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument (Dart_NativeArguments args, int index, int64_t *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument (Dart_NativeArguments args, int index, bool *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument (Dart_NativeArguments args, int index, double *value)
 
DART_EXPORT void Dart_SetReturnValue (Dart_NativeArguments args, Dart_Handle retval)
 
DART_EXPORT void Dart_SetWeakHandleReturnValue (Dart_NativeArguments args, Dart_WeakPersistentHandle rval)
 
DART_EXPORT void Dart_SetBooleanReturnValue (Dart_NativeArguments args, bool retval)
 
DART_EXPORT void Dart_SetIntegerReturnValue (Dart_NativeArguments args, int64_t retval)
 
DART_EXPORT void Dart_SetDoubleReturnValue (Dart_NativeArguments args, double retval)
 
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback (Dart_EnvironmentCallback callback)
 
DART_EXPORT Dart_Handle Dart_SetNativeResolver (Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
 
DART_EXPORT Dart_Handle Dart_GetNativeResolver (Dart_Handle library, Dart_NativeEntryResolver *resolver)
 
DART_EXPORT Dart_Handle Dart_GetNativeSymbol (Dart_Handle library, Dart_NativeEntrySymbol *resolver)
 
DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver (Dart_Handle library, Dart_FfiNativeResolver resolver)
 
DART_EXPORT void Dart_InitializeNativeAssetsResolver (NativeAssetsApi *native_assets_api)
 
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler (Dart_LibraryTagHandler handler)
 
DART_EXPORT Dart_Handle Dart_SetDeferredLoadHandler (Dart_DeferredLoadHandler handler)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_DeferredLoadComplete (intptr_t loading_unit_id, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_DeferredLoadCompleteError (intptr_t loading_unit_id, const char *error_message, bool transient)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadScriptFromKernel (const uint8_t *kernel_buffer, intptr_t kernel_size)
 
DART_EXPORT Dart_Handle Dart_RootLibrary (void)
 
DART_EXPORT Dart_Handle Dart_SetRootLibrary (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_GetType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
DART_EXPORT Dart_Handle Dart_GetNullableType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
DART_EXPORT Dart_Handle Dart_GetNonNullableType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
DART_EXPORT Dart_Handle Dart_TypeToNullableType (Dart_Handle type)
 
DART_EXPORT Dart_Handle Dart_TypeToNonNullableType (Dart_Handle type)
 
DART_EXPORT Dart_Handle Dart_IsNullableType (Dart_Handle type, bool *result)
 
DART_EXPORT Dart_Handle Dart_IsNonNullableType (Dart_Handle type, bool *result)
 
DART_EXPORT Dart_Handle Dart_GetClass (Dart_Handle library, Dart_Handle class_name)
 
DART_EXPORT Dart_Handle Dart_LibraryUrl (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_LibraryResolvedUrl (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_GetLoadedLibraries (void)
 
DART_EXPORT Dart_Handle Dart_LookupLibrary (Dart_Handle url)
 
DART_EXPORT Dart_Handle Dart_LibraryHandleError (Dart_Handle library, Dart_Handle error)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibraryFromKernel (const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibrary (Dart_Handle kernel_buffer)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_FinalizeLoading (bool complete_futures)
 
DART_EXPORT Dart_Handle Dart_GetPeer (Dart_Handle object, void **peer)
 
DART_EXPORT Dart_Handle Dart_SetPeer (Dart_Handle object, void *peer)
 
DART_EXPORT bool Dart_IsKernelIsolate (Dart_Isolate isolate)
 
DART_EXPORT bool Dart_KernelIsolateIsRunning (void)
 
DART_EXPORT Dart_Port Dart_KernelPort (void)
 
DART_EXPORT Dart_KernelCompilationResult Dart_CompileToKernel (const char *script_uri, const uint8_t *platform_kernel, const intptr_t platform_kernel_size, bool incremental_compile, bool snapshot_compile, bool embed_sources, const char *package_config, Dart_KernelCompilationVerbosityLevel verbosity)
 
DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies (void)
 
DART_EXPORT void Dart_SetDartLibrarySourcesKernel (const uint8_t *platform_kernel, const intptr_t platform_kernel_size)
 
DART_EXPORT bool Dart_DetectNullSafety (const char *script_uri, const char *package_config, const char *original_working_directory, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
DART_EXPORT bool Dart_IsServiceIsolate (Dart_Isolate isolate)
 
DART_EXPORT bool Dart_WriteProfileToTimeline (Dart_Port main_port, char **error)
 
DART_EXPORT Dart_Handle Dart_Precompile (void)
 
DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris (intptr_t loading_unit_id)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly (Dart_StreamingWriteCallback callback, void *callback_data, bool stripped, void *debug_callback_data)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssemblies (Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool stripped, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElf (Dart_StreamingWriteCallback callback, void *callback_data, bool stripped, void *debug_callback_data)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElfs (Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool stripped, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateVMAOTSnapshotAsAssembly (Dart_StreamingWriteCallback callback, void *callback_data)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SortClasses (void)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppJITSnapshotAsBlobs (uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, uint8_t **isolate_snapshot_instructions_buffer, intptr_t *isolate_snapshot_instructions_size)
 
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetObfuscationMap (uint8_t **buffer, intptr_t *buffer_length)
 
DART_EXPORT bool Dart_IsPrecompiledRuntime (void)
 
DART_EXPORT void Dart_DumpNativeStackTrace (void *context)
 
DART_EXPORT void Dart_PrepareToAbort (void)
 
DART_EXPORT void Dart_SetDwarfStackTraceFootnoteCallback (Dart_DwarfStackTraceFootnoteCallback callback)
 

Macro Definition Documentation

◆ __STDC_FORMAT_MACROS

#define __STDC_FORMAT_MACROS

Definition at line 21 of file dart_api.h.

◆ BITMASK

#define BITMASK (   size)    ((1 << size) - 1)

Definition at line 3068 of file dart_api.h.

◆ DART_DEPRECATED

#define DART_DEPRECATED (   msg)

Definition at line 67 of file dart_api.h.

◆ DART_EXTERN_C

#define DART_EXTERN_C   extern

Definition at line 35 of file dart_api.h.

◆ DART_FLAGS_CURRENT_VERSION

#define DART_FLAGS_CURRENT_VERSION   (0x0000000d)

Isolate specific flags are set when creating a new isolate using the Dart_IsolateFlags structure.

Current version of flags is encoded in a 32-bit integer with 16 bits used for each part.

Definition at line 582 of file dart_api.h.

◆ DART_INITIALIZE_PARAMS_CURRENT_VERSION

#define DART_INITIALIZE_PARAMS_CURRENT_VERSION   (0x00000008)

The current version of the Dart_InitializeFlags. Should be incremented every time Dart_InitializeFlags changes in a binary incompatible way.

Definition at line 840 of file dart_api.h.

◆ DART_KERNEL_ISOLATE_NAME

#define DART_KERNEL_ISOLATE_NAME   "kernel-service"

Definition at line 3880 of file dart_api.h.

◆ DART_NATIVE_ARG_DESCRIPTOR

#define DART_NATIVE_ARG_DESCRIPTOR (   type,
  position 
)
Value:
GLenum type
@ kNativeArgNumberSize
Definition: dart_api.h:3063
@ kNativeArgTypePos
Definition: dart_api.h:3064
@ kNativeArgTypeSize
Definition: dart_api.h:3065
#define BITMASK(size)
Definition: dart_api.h:3068

Definition at line 3069 of file dart_api.h.

◆ DART_VM_SERVICE_ISOLATE_NAME

#define DART_VM_SERVICE_ISOLATE_NAME   "vm-service"

Definition at line 3888 of file dart_api.h.

◆ DART_WARN_UNUSED_RESULT

#define DART_WARN_UNUSED_RESULT

Definition at line 66 of file dart_api.h.

◆ ILLEGAL_PORT

#define ILLEGAL_PORT   ((Dart_Port)0)

ILLEGAL_PORT is a port number guaranteed never to be associated with a valid port.

Definition at line 1535 of file dart_api.h.

◆ kIsolateSnapshotBssAsmSymbol

#define kIsolateSnapshotBssAsmSymbol   "_kDartIsolateSnapshotBss"

Definition at line 3970 of file dart_api.h.

◆ kIsolateSnapshotBssCSymbol

#define kIsolateSnapshotBssCSymbol   "_kDartIsolateSnapshotBss"

Definition at line 3960 of file dart_api.h.

◆ kIsolateSnapshotDataAsmSymbol

#define kIsolateSnapshotDataAsmSymbol   "_kDartIsolateSnapshotData"

Definition at line 3967 of file dart_api.h.

◆ kIsolateSnapshotDataCSymbol

#define kIsolateSnapshotDataCSymbol   "_kDartIsolateSnapshotData"

Definition at line 3958 of file dart_api.h.

◆ kIsolateSnapshotInstructionsAsmSymbol

#define kIsolateSnapshotInstructionsAsmSymbol    "_kDartIsolateSnapshotInstructions"

Definition at line 3968 of file dart_api.h.

◆ kIsolateSnapshotInstructionsCSymbol

#define kIsolateSnapshotInstructionsCSymbol   "_kDartIsolateSnapshotInstructions"

Definition at line 3959 of file dart_api.h.

◆ kSnapshotBuildIdAsmSymbol

#define kSnapshotBuildIdAsmSymbol   "_kDartSnapshotBuildId"

Definition at line 3963 of file dart_api.h.

◆ kSnapshotBuildIdCSymbol

#define kSnapshotBuildIdCSymbol   "_kDartSnapshotBuildId"

Definition at line 3954 of file dart_api.h.

◆ kVmSnapshotBssAsmSymbol

#define kVmSnapshotBssAsmSymbol   "_kDartVmSnapshotBss"

Definition at line 3966 of file dart_api.h.

◆ kVmSnapshotBssCSymbol

#define kVmSnapshotBssCSymbol   "_kDartVmSnapshotBss"

Definition at line 3957 of file dart_api.h.

◆ kVmSnapshotDataAsmSymbol

#define kVmSnapshotDataAsmSymbol   "_kDartVmSnapshotData"

Definition at line 3964 of file dart_api.h.

◆ kVmSnapshotDataCSymbol

#define kVmSnapshotDataCSymbol   "_kDartVmSnapshotData"

Definition at line 3955 of file dart_api.h.

◆ kVmSnapshotInstructionsAsmSymbol

#define kVmSnapshotInstructionsAsmSymbol   "_kDartVmSnapshotInstructions"

Definition at line 3965 of file dart_api.h.

◆ kVmSnapshotInstructionsCSymbol

#define kVmSnapshotInstructionsCSymbol   "_kDartVmSnapshotInstructions"

Definition at line 3956 of file dart_api.h.

Typedef Documentation

◆ Dart_CodeObserver

◆ Dart_CreateLoadingUnitCallback

typedef void(* Dart_CreateLoadingUnitCallback) (void *callback_data, intptr_t loading_unit_id, void **write_callback_data, void **write_debug_callback_data)

Definition at line 3930 of file dart_api.h.

◆ Dart_DeferredLoadHandler

typedef Dart_Handle(* Dart_DeferredLoadHandler) (intptr_t loading_unit_id)

Handles deferred loading requests. When this handler is invoked, it should eventually load the deferred loading unit with the given id and call Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError. It is recommended that the loading occur asynchronously, but it is permitted to call Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError before the handler returns.

If an error is returned, it will be propagated through prefix.loadLibrary(). This is useful for synchronous implementations, which must propagate any unwind errors from Dart_DeferredLoadComplete or Dart_DeferredLoadComplete. Otherwise the handler should return a non-error such as Dart_Null().

Definition at line 3491 of file dart_api.h.

◆ Dart_DwarfStackTraceFootnoteCallback

typedef char *(* Dart_DwarfStackTraceFootnoteCallback) (void *addresses[], intptr_t count)

Callback provided by the embedder that is used by the VM to produce footnotes appended to DWARF stack traces.

Whenever VM formats a stack trace as a string it would call this callback passing raw program counters for each frame in the stack trace.

Embedder can then return a string which if not-null will be appended to the formatted stack trace.

Returned string is expected to be malloc() allocated. VM takes ownership of the returned string and will free() it.

Parameters
addressesraw program counter addresses for each frame
countnumber of elements in the addresses array

Definition at line 4145 of file dart_api.h.

◆ Dart_EntropySource

typedef bool(* Dart_EntropySource) (uint8_t *buffer, intptr_t length)

Definition at line 822 of file dart_api.h.

◆ Dart_EnvironmentCallback

typedef Dart_Handle(* Dart_EnvironmentCallback) (Dart_Handle name)

An environment lookup callback function.

Parameters
nameThe name of the value to lookup in the environment.
Returns
A valid handle to a string if the name exists in the current environment or Dart_Null() if not.

Definition at line 3278 of file dart_api.h.

◆ Dart_FfiNativeResolver

typedef void *(* Dart_FfiNativeResolver) (const char *name, uintptr_t args_n)

FFI Native C function pointer resolver callback.

See Dart_SetFfiNativeResolver.

Definition at line 3262 of file dart_api.h.

◆ Dart_FileCloseCallback

typedef void(* Dart_FileCloseCallback) (void *stream)

Closes the opened file.

Callback provided by the embedder for file operations. If the embedder does not allow file operations this callback can be NULL.

Parameters
streamHandle to the opened file.

Definition at line 820 of file dart_api.h.

◆ Dart_FileOpenCallback

typedef void *(* Dart_FileOpenCallback) (const char *name, bool write)

Opens a file for reading or writing.

Callback provided by the embedder for file operations. If the embedder does not allow file operations this callback can be NULL.

Parameters
nameThe name of the file to open.
writeA boolean variable which indicates if the file is to opened for writing. If there is an existing file it needs to truncated.

Definition at line 776 of file dart_api.h.

◆ Dart_FileReadCallback

typedef void(* Dart_FileReadCallback) (uint8_t **data, intptr_t *file_length, void *stream)

Read contents of file.

Callback provided by the embedder for file operations. If the embedder does not allow file operations this callback can be NULL.

Parameters
dataBuffer allocated in the callback into which the contents of the file are read into. It is the responsibility of the caller to free this buffer.
file_lengthA variable into which the length of the file is returned. In the case of an error this value would be -1.
streamHandle to the opened file.

Definition at line 792 of file dart_api.h.

◆ Dart_FileWriteCallback

typedef void(* Dart_FileWriteCallback) (const void *data, intptr_t length, void *stream)

Write data into file.

Callback provided by the embedder for file operations. If the embedder does not allow file operations this callback can be NULL.

Parameters
dataBuffer which needs to be written into the file.
lengthLength of the buffer.
streamHandle to the opened file.

Definition at line 807 of file dart_api.h.

◆ Dart_FinalizableHandle

typedef struct _Dart_FinalizableHandle* Dart_FinalizableHandle

Definition at line 261 of file dart_api.h.

◆ Dart_GetVMServiceAssetsArchive

typedef Dart_Handle(* Dart_GetVMServiceAssetsArchive) (void)

Callback provided by the embedder that is used by the vmservice isolate to request the asset archive. The asset archive must be an uncompressed tar archive that is stored in a Uint8List.

If the embedder has no vmservice isolate assets, the callback can be NULL.

Returns
The embedder must return a handle to a Uint8List containing an uncompressed tar archive or null.

Definition at line 834 of file dart_api.h.

◆ Dart_Handle

typedef struct _Dart_Handle* Dart_Handle

An object reference managed by the Dart VM garbage collector.

Because the garbage collector may move objects, it is unsafe to refer to objects directly. Instead, we refer to objects through handles, which are known to the garbage collector and updated automatically when the object is moved. Handles should be passed by value (except in cases like out-parameters) and should never be allocated on the heap.

Most functions in the Dart Embedding API return a handle. When a function completes normally, this will be a valid handle to an object in the Dart VM heap. This handle may represent the result of the operation or it may be a special valid handle used merely to indicate successful completion. Note that a valid handle may in some cases refer to the null object.

— Error handles —

When a function encounters a problem that prevents it from completing normally, it returns an error handle (See Dart_IsError). An error handle has an associated error message that gives more details about the problem (See Dart_GetError).

There are four kinds of error handles that can be produced, depending on what goes wrong:

  • Api error handles are produced when an api function is misused. This happens when a Dart embedding api function is called with invalid arguments or in an invalid context.
  • Unhandled exception error handles are produced when, during the execution of Dart code, an exception is thrown but not caught. Prototypically this would occur during a call to Dart_Invoke, but it can occur in any function which triggers the execution of Dart code (for example, Dart_ToString).

    An unhandled exception error provides access to an exception and stacktrace via the functions Dart_ErrorGetException and Dart_ErrorGetStackTrace.

  • Compilation error handles are produced when, during the execution of Dart code, a compile-time error occurs. As above, this can occur in any function which triggers the execution of Dart code.
  • Fatal error handles are produced when the system wants to shut down the current isolate.

— Propagating errors —

When an error handle is returned from the top level invocation of Dart code in a program, the embedder must handle the error as they see fit. Often, the embedder will print the error message produced by Dart_Error and exit the program.

When an error is returned while in the body of a native function, it can be propagated up the call stack by calling Dart_PropagateError, Dart_SetReturnValue, or Dart_ThrowException. Errors should be propagated unless there is a specific reason not to. If an error is not propagated then it is ignored. For example, if an unhandled exception error is ignored, that effectively "catches" the unhandled exception. Fatal errors must always be propagated.

When an error is propagated, any current scopes created by Dart_EnterScope will be exited.

Using Dart_SetReturnValue to propagate an exception is somewhat more convenient than using Dart_PropagateError, and should be preferred for reasons discussed below.

Dart_PropagateError and Dart_ThrowException do not return. Instead they transfer control non-locally using a setjmp-like mechanism. This can be inconvenient if you have resources that you need to clean up before propagating the error.

When relying on Dart_PropagateError, we often return error handles rather than propagating them from helper functions. Consider the following contrived example:

1 Dart_Handle isLongStringHelper(Dart_Handle arg) { 2 intptr_t* length = 0; 3 result = Dart_StringLength(arg, &length); 4 if (Dart_IsError(result)) { 5 return result; 6 } 7 return Dart_NewBoolean(length > 100); 8 } 9 10 void NativeFunction_isLongString(Dart_NativeArguments args) { 11 Dart_EnterScope(); 12 AllocateMyResource(); 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0); 14 Dart_Handle result = isLongStringHelper(arg); 15 if (Dart_IsError(result)) { 16 FreeMyResource(); 17 Dart_PropagateError(result); 18 abort(); // will not reach here 19 } 20 Dart_SetReturnValue(result); 21 FreeMyResource(); 22 Dart_ExitScope(); 23 }

In this example, we have a native function which calls a helper function to do its work. On line 5, the helper function could call Dart_PropagateError, but that would not give the native function a chance to call FreeMyResource(), causing a leak. Instead, the helper function returns the error handle to the caller, giving the caller a chance to clean up before propagating the error handle.

When an error is propagated by calling Dart_SetReturnValue, the native function will be allowed to complete normally and then the exception will be propagated only once the native call returns. This can be convenient, as it allows the C code to clean up normally.

The example can be written more simply using Dart_SetReturnValue to propagate the error.

1 Dart_Handle isLongStringHelper(Dart_Handle arg) { 2 intptr_t* length = 0; 3 result = Dart_StringLength(arg, &length); 4 if (Dart_IsError(result)) { 5 return result 6 } 7 return Dart_NewBoolean(length > 100); 8 } 9 10 void NativeFunction_isLongString(Dart_NativeArguments args) { 11 Dart_EnterScope(); 12 AllocateMyResource(); 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0); 14 Dart_SetReturnValue(isLongStringHelper(arg)); 15 FreeMyResource(); 16 Dart_ExitScope(); 17 }

In this example, the call to Dart_SetReturnValue on line 14 will either return the normal return value or the error (potentially generated on line 3). The call to FreeMyResource on line 15 will execute in either case.

— Local and persistent handles —

Local handles are allocated within the current scope (see Dart_EnterScope) and go away when the current scope exits. Unless otherwise indicated, callers should assume that all functions in the Dart embedding api return local handles.

Persistent handles are allocated within the current isolate. They can be used to store objects across scopes. Persistent handles have the lifetime of the current isolate unless they are explicitly deallocated (see Dart_DeletePersistentHandle). The type Dart_Handle represents a handle (both local and persistent). The type Dart_PersistentHandle is a Dart_Handle and it is used to document that a persistent handle is expected as a parameter to a call or the return value from a call is a persistent handle.

FinalizableHandles are persistent handles which are auto deleted when the object is garbage collected. It is never safe to use these handles unless you know the object is still reachable.

WeakPersistentHandles are persistent handles which are automatically set to point Dart_Null when the object is garbage collected. They are not auto deleted, so it is safe to use them after the object has become unreachable.

Definition at line 258 of file dart_api.h.

◆ Dart_HandleFinalizer

typedef void(* Dart_HandleFinalizer) (void *isolate_callback_data, void *peer)

Definition at line 265 of file dart_api.h.

◆ Dart_HeapSamplingCreateCallback

typedef void *(* Dart_HeapSamplingCreateCallback) (Dart_Isolate isolate, Dart_IsolateGroup isolate_group, const char *cls_name, intptr_t allocation_size)

Definition at line 1283 of file dart_api.h.

◆ Dart_HeapSamplingDeleteCallback

typedef void(* Dart_HeapSamplingDeleteCallback) (void *data)

Definition at line 1288 of file dart_api.h.

◆ Dart_HeapSamplingReportCallback

typedef void(* Dart_HeapSamplingReportCallback) (void *context, void *data)

Definition at line 1281 of file dart_api.h.

◆ Dart_InitializeIsolateCallback

typedef bool(* Dart_InitializeIsolateCallback) (void **child_isolate_data, char **error)

An isolate initialization callback function.

This callback, provided by the embedder, is called when the VM has created an isolate within an existing isolate group (i.e. from the same source as an existing isolate).

The callback should setup native resolvers and might want to set a custom message handler via [Dart_SetMessageNotifyCallback] and mark the isolate as runnable.

This callback may be called on a different thread than the one running the parent isolate.

When the function returns false, it is the responsibility of this function to ensure that Dart_ShutdownIsolate has been called.

When the function returns false, the function should set *error to a malloc-allocated buffer containing a useful error message. The caller of this function (the VM) will make sure that the buffer is freed.

Parameters
child_isolate_dataThe callback data to associate with the new child isolate.
errorA structure into which the embedder can place a C string containing an error message in the case the initialization fails.
Returns
The embedder returns true if the initialization was successful and false otherwise (in which case the VM will terminate the isolate).

Definition at line 693 of file dart_api.h.

◆ Dart_Isolate

typedef struct _Dart_Isolate* Dart_Isolate

An isolate is the unit of concurrency in Dart. Each isolate has its own memory and thread of control. No state is shared between isolates. Instead, isolates communicate by message passing.

Each thread keeps track of its current isolate, which is the isolate which is ready to execute on the current thread. The current isolate may be NULL, in which case no isolate is ready to execute. Most of the Dart apis require there to be a current isolate in order to function without error. The current isolate is set by any call to Dart_CreateIsolateGroup or Dart_EnterIsolate.

Definition at line 88 of file dart_api.h.

◆ Dart_IsolateCleanupCallback

typedef void(* Dart_IsolateCleanupCallback) (void *isolate_group_data, void *isolate_data)

An isolate cleanup callback function.

This callback, provided by the embedder, is called after the vm shuts down an isolate. There will be no current isolate and it is not safe to run Dart code.

This function should be used to dispose of native resources that are allocated to an isolate in order to avoid leaks.

Parameters
isolate_group_dataThe same callback data which was passed to the isolate group when it was created.
isolate_dataThe same callback data which was passed to the isolate when it was created.

Definition at line 729 of file dart_api.h.

◆ Dart_IsolateGroup

typedef struct _Dart_IsolateGroup* Dart_IsolateGroup

Definition at line 89 of file dart_api.h.

◆ Dart_IsolateGroupCleanupCallback

typedef void(* Dart_IsolateGroupCleanupCallback) (void *isolate_group_data)

An isolate group cleanup callback function.

This callback, provided by the embedder, is called after the vm shuts down an isolate group.

This function should be used to dispose of native resources that are allocated to an isolate in order to avoid leaks.

Parameters
isolate_group_dataThe same callback data which was passed to the isolate group when it was created.

Definition at line 745 of file dart_api.h.

◆ Dart_IsolateGroupCreateCallback

typedef Dart_Isolate(* Dart_IsolateGroupCreateCallback) (const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)

An isolate creation and initialization callback function.

This callback, provided by the embedder, is called when the VM needs to create an isolate. The callback should create an isolate by calling Dart_CreateIsolateGroup and load any scripts required for execution.

This callback may be called on a different thread than the one running the parent isolate.

When the function returns NULL, it is the responsibility of this function to ensure that Dart_ShutdownIsolate has been called if required (for example, if the isolate was created successfully by Dart_CreateIsolateGroup() but the root library fails to load successfully, then the function should call Dart_ShutdownIsolate before returning).

When the function returns NULL, the function should set *error to a malloc-allocated buffer containing a useful error message. The caller of this function (the VM) will make sure that the buffer is freed.

Parameters
script_uriThe uri of the main source file or snapshot to load. Either the URI of the parent isolate set in Dart_CreateIsolateGroup for Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the library tag handler of the parent isolate. The callback is responsible for loading the program by a call to Dart_LoadScriptFromKernel.
mainThe name of the main entry point this isolate will eventually run. This is provided for advisory purposes only to improve debugging messages. The main function is not invoked by this function.
package_rootIgnored.
package_configUri of the package configuration file (either in format of .packages or .dart_tool/package_config.json) for this isolate to resolve package imports against. If this parameter is not passed the package resolution of the parent isolate should be used.
flagsDefault flags for this isolate being spawned. Either inherited from the spawning isolate or passed as parameters when spawning the isolate from Dart code.
isolate_dataThe isolate data which was passed to the parent isolate when it was created by calling Dart_CreateIsolateGroup().
errorA structure into which the embedder can place a C string containing an error message in the case of failures.
Returns
The embedder returns NULL if the creation and initialization was not successful and the isolate if successful.

Definition at line 654 of file dart_api.h.

◆ Dart_IsolateGroupId

typedef int64_t Dart_IsolateGroupId

Gets an id that uniquely identifies current isolate group.

It is the responsibility of the caller to free the returned ID.

Definition at line 1209 of file dart_api.h.

◆ Dart_IsolateShutdownCallback

typedef void(* Dart_IsolateShutdownCallback) (void *isolate_group_data, void *isolate_data)

An isolate shutdown callback function.

This callback, provided by the embedder, is called before the vm shuts down an isolate. The isolate being shutdown will be the current isolate. It is safe to run Dart code.

This function should be used to dispose of native resources that are allocated to an isolate in order to avoid leaks.

Parameters
isolate_group_dataThe same callback data which was passed to the isolate group when it was created.
isolate_dataThe same callback data which was passed to the isolate when it was created.

Definition at line 711 of file dart_api.h.

◆ Dart_LibraryTagHandler

typedef Dart_Handle(* Dart_LibraryTagHandler) (Dart_LibraryTag tag, Dart_Handle library_or_package_map_url, Dart_Handle url)

The library tag handler is a multi-purpose callback provided by the embedder to the Dart VM. The embedder implements the tag handler to provide the ability to load Dart scripts and imports.

– TAGS –

Dart_kCanonicalizeUrl

This tag indicates that the embedder should canonicalize 'url' with respect to 'library'. For most embedders, this is resolving the url relative to the librarys url (see Dart_LibraryUrl).

Dart_kImportTag

This tag is used to load a library from IsolateMirror.loadUri. The embedder should call Dart_LoadLibraryFromKernel to provide the library to the VM. The return value should be an error or library (the result from Dart_LoadLibraryFromKernel).

Dart_kKernelTag

This tag is used to load the intermediate file (kernel) generated by the Dart front end. This tag is typically used when a 'hot-reload' of an application is needed and the VM is 'use dart front end' mode. The dart front end typically compiles all the scripts, imports and part files into one intermediate file hence we don't use the source/import or script tags. The return value should be an error or a TypedData containing the kernel bytes.

Definition at line 3456 of file dart_api.h.

◆ Dart_MessageNotifyCallback

typedef void(* Dart_MessageNotifyCallback) (Dart_Isolate destination_isolate)

A message notification callback.

This callback allows the embedder to provide a custom wakeup mechanism for the delivery of inter-isolate messages. This function is called once per message on an arbitrary thread. It is the responsibility of the embedder to eventually call Dart_HandleMessage once per callback received with the destination isolate set as the current isolate to process the message.

Definition at line 1546 of file dart_api.h.

◆ Dart_NativeArgument_Descriptor

◆ Dart_NativeArgument_Value

◆ Dart_NativeArguments

typedef struct _Dart_NativeArguments* Dart_NativeArguments

The arguments to a native function.

This object is passed to a native function to represent its arguments and return value. It allows access to the arguments to a native function by index. It also allows the return value of a native function to be set.

Definition at line 3019 of file dart_api.h.

◆ Dart_NativeAssetsDlopenCallback

typedef void *(* Dart_NativeAssetsDlopenCallback) (const char *path, char **error)

Callback provided by the embedder that is used by the VM to resolve asset paths. If no callback is provided, using @Natives with native_asset.yamls will fail.

The VM is responsible for looking up the asset path with the asset id in the kernel mapping. The embedder is responsible for providing the asset mapping during kernel compilation and using the asset path to return a library handle in this function.

Parameters
pathThe string in the asset path as passed in native_assets.yaml during kernel compilation.
errorReturns NULL if creation is successful, an error message otherwise. The caller is responsible for calling free() on the error message.
Returns
The library handle. If |error| is not-null, the return value is undefined.

Definition at line 3364 of file dart_api.h.

◆ Dart_NativeAssetsDlopenCallbackNoPath

typedef void *(* Dart_NativeAssetsDlopenCallbackNoPath) (char **error)

Definition at line 3366 of file dart_api.h.

◆ Dart_NativeAssetsDlsymCallback

typedef void *(* Dart_NativeAssetsDlsymCallback) (void *handle, const char *symbol, char **error)

Callback provided by the embedder that is used by the VM to lookup symbols in native code assets. If no callback is provided, using @Natives with native_asset.yamls will fail.

Parameters
handleThe library handle returned from a Dart_NativeAssetsDlopenCallback or Dart_NativeAssetsDlopenCallbackNoPath.
symbolThe symbol to look up. Is a string.
errorReturns NULL if creation is successful, an error message otherwise. The caller is responsible for calling free() on the error message.
Returns
The symbol address. If |error| is not-null, the return value is undefined.

Definition at line 3387 of file dart_api.h.

◆ Dart_NativeEntryResolver

typedef Dart_NativeFunction(* Dart_NativeEntryResolver) (Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)

Native entry resolution callback.

For libraries and scripts which have native functions, the embedder can provide a native entry resolver. This callback is used to map a name/arity to a Dart_NativeFunction. If no function is found, the callback should return NULL.

The parameters to the native resolver function are:

Parameters
namea Dart string which is the name of the native function.
num_of_argumentsis the number of arguments expected by the native function.
auto_setup_scopeis a boolean flag that can be set by the resolver to indicate if this function needs a Dart API scope (see Dart_EnterScope/ Dart_ExitScope) to be setup automatically by the VM before calling into the native function. By default most native functions would require this to be true but some light weight native functions which do not call back into the VM through the Dart API may not require a Dart scope to be setup automatically.
Returns
A valid Dart_NativeFunction which resolves to a native entry point for the native function.

See Dart_SetNativeResolver.

Definition at line 3234 of file dart_api.h.

◆ Dart_NativeEntrySymbol

typedef const uint8_t *(* Dart_NativeEntrySymbol) (Dart_NativeFunction nf)

Native entry symbol lookup callback.

For libraries and scripts which have native functions, the embedder can provide a callback for mapping a native entry to a symbol. This callback maps a native function entry PC to the native function name. If no native entry symbol can be found, the callback should return NULL.

The parameters to the native reverse resolver function are:

Parameters
nfA Dart_NativeFunction.
Returns
A const UTF-8 string containing the symbol name or NULL.

See Dart_SetNativeResolver.

Definition at line 3255 of file dart_api.h.

◆ Dart_NativeFunction

typedef void(* Dart_NativeFunction) (Dart_NativeArguments arguments)

A native function.

Definition at line 3207 of file dart_api.h.

◆ Dart_OnNewCodeCallback

typedef void(* Dart_OnNewCodeCallback) (struct Dart_CodeObserver *observer, const char *name, uintptr_t base, uintptr_t size)

Callback provided by the embedder that is used by the VM to notify on code object creation, before it is invoked the first time. This is useful for embedders wanting to e.g. keep track of PCs beyond the lifetime of the garbage collected code objects. Note that an address range may be used by more than one code object over the lifecycle of a process. Clients of this function should record timestamps for these compilation events and when collecting PCs to disambiguate reused address ranges.

Definition at line 855 of file dart_api.h.

◆ Dart_PersistentHandle

Definition at line 259 of file dart_api.h.

◆ Dart_Port

typedef int64_t Dart_Port

A port is used to send or receive inter-isolate messages

Definition at line 1525 of file dart_api.h.

◆ Dart_RegisterKernelBlobCallback

typedef const char *(* Dart_RegisterKernelBlobCallback) (const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)

Optional callback provided by the embedder that is used by the VM to implement registration of kernel blobs for the subsequent Isolate.spawnUri If no callback is provided, the registration of kernel blobs will throw an error.

Parameters
kernel_bufferA buffer which contains a kernel program. Callback should copy the contents of kernel_buffer as it may be freed immediately after registration.
kernel_buffer_sizeThe size of kernel_buffer.
Returns
A C string representing URI which can be later used to spawn a new isolate. This C String should be scope allocated or owned by the embedder. Returns NULL if embedder runs out of memory.

Definition at line 882 of file dart_api.h.

◆ Dart_StreamingCloseCallback

typedef void(* Dart_StreamingCloseCallback) (void *callback_data)

Definition at line 3938 of file dart_api.h.

◆ Dart_StreamingWriteCallback

typedef void(* Dart_StreamingWriteCallback) (void *callback_data, const uint8_t *buffer, intptr_t size)

Definition at line 3935 of file dart_api.h.

◆ Dart_ThreadExitCallback

typedef void(* Dart_ThreadExitCallback) (void)

A thread death callback function. This callback, provided by the embedder, is called before a thread in the vm thread pool exits. This function could be used to dispose of native resources that are associated and attached to the thread, in order to avoid leaks.

Definition at line 763 of file dart_api.h.

◆ Dart_ThreadStartCallback

typedef void(* Dart_ThreadStartCallback) (void)

A thread start callback function. This callback, provided by the embedder, is called after a thread in the vm thread pool starts. This function could be used to adjust thread priority or attach native resources to the thread.

Definition at line 754 of file dart_api.h.

◆ Dart_UnregisterKernelBlobCallback

typedef void(* Dart_UnregisterKernelBlobCallback) (const char *kernel_blob_uri)

Optional callback provided by the embedder that is used by the VM to unregister kernel blobs. If no callback is provided, the unregistration of kernel blobs will throw an error.

Parameters
kernel_blob_uriURI of the kernel blob to unregister.

Definition at line 894 of file dart_api.h.

◆ Dart_WeakPersistentHandle

typedef struct _Dart_WeakPersistentHandle* Dart_WeakPersistentHandle

Definition at line 260 of file dart_api.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kNativeArgNumberPos 
kNativeArgNumberSize 
kNativeArgTypePos 
kNativeArgTypeSize 

Definition at line 3061 of file dart_api.h.

◆ Dart_KernelCompilationStatus

Experimental support for Dart to Kernel parser isolate.

TODO(hausner): Document finalized interface.

Enumerator
Dart_KernelCompilationStatus_Unknown 
Dart_KernelCompilationStatus_Ok 
Dart_KernelCompilationStatus_Error 
Dart_KernelCompilationStatus_Crash 
Dart_KernelCompilationStatus_MsgFailed 

Definition at line 3783 of file dart_api.h.

3783 {
Dart_KernelCompilationStatus
Definition: dart_api.h:3783
@ Dart_KernelCompilationStatus_MsgFailed
Definition: dart_api.h:3788
@ Dart_KernelCompilationStatus_Error
Definition: dart_api.h:3786
@ Dart_KernelCompilationStatus_Crash
Definition: dart_api.h:3787
@ Dart_KernelCompilationStatus_Unknown
Definition: dart_api.h:3784
@ Dart_KernelCompilationStatus_Ok
Definition: dart_api.h:3785

◆ Dart_KernelCompilationVerbosityLevel

Enumerator
Dart_KernelCompilationVerbosityLevel_Error 
Dart_KernelCompilationVerbosityLevel_Warning 
Dart_KernelCompilationVerbosityLevel_Info 
Dart_KernelCompilationVerbosityLevel_All 

Definition at line 3798 of file dart_api.h.

3798 {
Dart_KernelCompilationVerbosityLevel
Definition: dart_api.h:3798
@ Dart_KernelCompilationVerbosityLevel_Error
Definition: dart_api.h:3799
@ Dart_KernelCompilationVerbosityLevel_Warning
Definition: dart_api.h:3800
@ Dart_KernelCompilationVerbosityLevel_All
Definition: dart_api.h:3802
@ Dart_KernelCompilationVerbosityLevel_Info
Definition: dart_api.h:3801

◆ Dart_LibraryTag

Enumerator
Dart_kCanonicalizeUrl 
Dart_kImportTag 
Dart_kKernelTag 

Definition at line 3419 of file dart_api.h.

3419 {
Dart_LibraryTag
Definition: dart_api.h:3419
@ Dart_kImportTag
Definition: dart_api.h:3421
@ Dart_kCanonicalizeUrl
Definition: dart_api.h:3420
@ Dart_kKernelTag
Definition: dart_api.h:3422

◆ Dart_NativeArgument_Type

Enumerator
Dart_NativeArgument_kBool 
Dart_NativeArgument_kInt32 
Dart_NativeArgument_kUint32 
Dart_NativeArgument_kInt64 
Dart_NativeArgument_kUint64 
Dart_NativeArgument_kDouble 
Dart_NativeArgument_kString 
Dart_NativeArgument_kInstance 
Dart_NativeArgument_kNativeFields 

Definition at line 3026 of file dart_api.h.

3026 {
Dart_NativeArgument_Type
Definition: dart_api.h:3026
@ Dart_NativeArgument_kString
Definition: dart_api.h:3033
@ Dart_NativeArgument_kInt64
Definition: dart_api.h:3030
@ Dart_NativeArgument_kNativeFields
Definition: dart_api.h:3035
@ Dart_NativeArgument_kInstance
Definition: dart_api.h:3034
@ Dart_NativeArgument_kInt32
Definition: dart_api.h:3028
@ Dart_NativeArgument_kUint64
Definition: dart_api.h:3031
@ Dart_NativeArgument_kUint32
Definition: dart_api.h:3029
@ Dart_NativeArgument_kDouble
Definition: dart_api.h:3032
@ Dart_NativeArgument_kBool
Definition: dart_api.h:3027

◆ Dart_PerformanceMode

Enumerator
Dart_PerformanceMode_Default 

Balanced

Dart_PerformanceMode_Latency 

Optimize for low latency, at the expense of throughput and memory overhead by performing work in smaller batches (requiring more overhead) or by delaying work (requiring more memory). An embedder should not remain in this mode indefinitely.

Dart_PerformanceMode_Throughput 

Optimize for high throughput, at the expense of latency and memory overhead by performing work in larger batches with more intervening growth.

Dart_PerformanceMode_Memory 

Optimize for low memory, at the expensive of throughput and latency by more frequently performing work.

Definition at line 1369 of file dart_api.h.

1369 {
1370 /**
1371 * Balanced
1372 */
1374 /**
1375 * Optimize for low latency, at the expense of throughput and memory overhead
1376 * by performing work in smaller batches (requiring more overhead) or by
1377 * delaying work (requiring more memory). An embedder should not remain in
1378 * this mode indefinitely.
1379 */
1381 /**
1382 * Optimize for high throughput, at the expense of latency and memory overhead
1383 * by performing work in larger batches with more intervening growth.
1384 */
1386 /**
1387 * Optimize for low memory, at the expensive of throughput and latency by more
1388 * frequently performing work.
1389 */
Dart_PerformanceMode
Definition: dart_api.h:1369
@ Dart_PerformanceMode_Default
Definition: dart_api.h:1373
@ Dart_PerformanceMode_Latency
Definition: dart_api.h:1380
@ Dart_PerformanceMode_Memory
Definition: dart_api.h:1390
@ Dart_PerformanceMode_Throughput
Definition: dart_api.h:1385

◆ Dart_TypedData_Type

Enumerator
Dart_TypedData_kByteData 
Dart_TypedData_kInt8 
Dart_TypedData_kUint8 
Dart_TypedData_kUint8Clamped 
Dart_TypedData_kInt16 
Dart_TypedData_kUint16 
Dart_TypedData_kInt32 
Dart_TypedData_kUint32 
Dart_TypedData_kInt64 
Dart_TypedData_kUint64 
Dart_TypedData_kFloat32 
Dart_TypedData_kFloat64 
Dart_TypedData_kInt32x4 
Dart_TypedData_kFloat32x4 
Dart_TypedData_kFloat64x2 
Dart_TypedData_kInvalid 

Definition at line 2612 of file dart_api.h.

2612 {
Dart_TypedData_Type
Definition: dart_api.h:2612
@ Dart_TypedData_kFloat32x4
Definition: dart_api.h:2626
@ Dart_TypedData_kInt32x4
Definition: dart_api.h:2625
@ Dart_TypedData_kUint8
Definition: dart_api.h:2615
@ Dart_TypedData_kUint32
Definition: dart_api.h:2620
@ Dart_TypedData_kInt32
Definition: dart_api.h:2619
@ Dart_TypedData_kUint16
Definition: dart_api.h:2618
@ Dart_TypedData_kFloat64x2
Definition: dart_api.h:2627
@ Dart_TypedData_kUint64
Definition: dart_api.h:2622
@ Dart_TypedData_kFloat32
Definition: dart_api.h:2623
@ Dart_TypedData_kInt16
Definition: dart_api.h:2617
@ Dart_TypedData_kFloat64
Definition: dart_api.h:2624
@ Dart_TypedData_kUint8Clamped
Definition: dart_api.h:2616
@ Dart_TypedData_kByteData
Definition: dart_api.h:2613
@ Dart_TypedData_kInt8
Definition: dart_api.h:2614
@ Dart_TypedData_kInt64
Definition: dart_api.h:2621
@ Dart_TypedData_kInvalid
Definition: dart_api.h:2628

Function Documentation

◆ Dart_AddSymbols()

DART_EXPORT void Dart_AddSymbols ( const char *  dso_name,
void *  buffer,
intptr_t  buffer_size 
)

Register symbol information for the Dart VM's profiler and crash dumps.

This consumes the output of //topaz/runtime/dart/profiler_symbols, which should be treated as opaque.

◆ Dart_Allocate()

Allocate a new object without invoking a constructor.

Parameters
typeThe type of an object to be allocated.
Returns
The new object. If an error occurs during execution, then an error handle is returned.

◆ Dart_AllocateWithNativeFields()

DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields ( Dart_Handle  type,
intptr_t  num_native_fields,
const intptr_t *  native_fields 
)

Allocate a new object without invoking a constructor, and sets specified native fields.

Parameters
typeThe type of an object to be allocated.
num_native_fieldsThe number of native fields to set.
native_fieldsAn array containing the value of native fields.
Returns
The new object. If an error occurs during execution, then an error handle is returned.

◆ Dart_BooleanValue()

DART_EXPORT Dart_Handle Dart_BooleanValue ( Dart_Handle  boolean_obj,
bool *  value 
)

Gets the value of a Boolean

Parameters
boolean_objA Boolean
valueReturns the value of the Boolean.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_ClassLibrary()

DART_EXPORT Dart_Handle Dart_ClassLibrary ( Dart_Handle  cls_type)

Returns a handle to the library which contains class.

Returns
A valid handle to the library with owns class, null if the class has no library or an error handle if the argument is not a valid handle to a class type.

◆ Dart_ClassName()

DART_EXPORT Dart_Handle Dart_ClassName ( Dart_Handle  cls_type)

Returns the name for the provided class type.

Returns
A valid string handle if no error occurs during the operation.

◆ Dart_Cleanup()

DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Cleanup ( void  )

Cleanup state in the VM before process termination.

Returns
NULL if cleanup is successful. Returns an error message otherwise. The caller is responsible for freeing the error message.

NOTE: This function must not be called on a thread that was created by the VM itself.

◆ Dart_ClosureFunction()

DART_EXPORT Dart_Handle Dart_ClosureFunction ( Dart_Handle  closure)

Retrieves the function of a closure.

Returns
A handle to the function of the closure, or an error handle if the argument is not a closure.

◆ Dart_CompileToKernel()

DART_EXPORT Dart_KernelCompilationResult Dart_CompileToKernel ( const char *  script_uri,
const uint8_t *  platform_kernel,
const intptr_t  platform_kernel_size,
bool  incremental_compile,
bool  snapshot_compile,
bool  embed_sources,
const char *  package_config,
Dart_KernelCompilationVerbosityLevel  verbosity 
)

Compiles the given script_uri to a kernel file.

Parameters
platform_kernelA buffer containing the kernel of the platform (e.g. vm_platform_strong.dill). The VM does not take ownership of this memory.
platform_kernel_sizeThe length of the platform_kernel buffer.
snapshot_compileSet to true when the compilation is for a snapshot. This is used by the frontend to determine if compilation related information should be printed to console (e.g., null safety mode).
embed_sourcesSet to true when sources should be embedded in the kernel file.
verbositySpecifies the logging behavior of the kernel compilation service.
Returns
Returns the result of the compilation.

On a successful compilation the returned [Dart_KernelCompilationResult] has a status of [Dart_KernelCompilationStatus_Ok] and the kernel/kernel_size fields are set. The caller takes ownership of the malloc()ed buffer.

On a failed compilation the error might be set describing the reason for the failed compilation. The caller takes ownership of the malloc()ed error.

Requires there to be a current isolate.

◆ Dart_CopyUTF8EncodingOfString()

DART_EXPORT Dart_Handle Dart_CopyUTF8EncodingOfString ( Dart_Handle  str,
uint8_t *  utf8_array,
intptr_t  length 
)

Copies the UTF-8 encoded representation of a String into specified buffer.

Any unpaired surrogate code points in the string will be converted as replacement characters (U+FFFD, 0xEF 0xBF 0xBD in UTF-8).

Parameters
strA string.
utf8_arrayBuffer into which the UTF-8 encoded representation of the string is copied into. The buffer is allocated and managed by the caller.
lengthSpecifies the length of the buffer passed in.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_CreateAppAOTSnapshotAsAssemblies()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssemblies ( Dart_CreateLoadingUnitCallback  next_callback,
void *  next_callback_data,
bool  stripped,
Dart_StreamingWriteCallback  write_callback,
Dart_StreamingCloseCallback  close_callback 
)

◆ Dart_CreateAppAOTSnapshotAsAssembly()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly ( Dart_StreamingWriteCallback  callback,
void *  callback_data,
bool  stripped,
void *  debug_callback_data 
)

Creates a precompiled snapshot.

  • A root library must have been loaded.
  • Dart_Precompile must have been called.

Outputs an assembly file defining the symbols listed in the definitions above.

The assembly should be compiled as a static or shared library and linked or loaded by the embedder. Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to Dart_Initialize. The kDartIsolateSnapshotData and kDartIsolateSnapshotInstructions should be passed to Dart_CreateIsolateGroup.

The callback will be invoked one or more times to provide the assembly code.

If stripped is true, then the assembly code will not include DWARF debugging sections.

If debug_callback_data is provided, debug_callback_data will be used with the callback to provide separate debugging information.

Returns
A valid handle if no error occurs during the operation.

◆ Dart_CreateAppAOTSnapshotAsElf()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElf ( Dart_StreamingWriteCallback  callback,
void *  callback_data,
bool  stripped,
void *  debug_callback_data 
)

Creates a precompiled snapshot.

  • A root library must have been loaded.
  • Dart_Precompile must have been called.

Outputs an ELF shared library defining the symbols

  • _kDartVmSnapshotData
  • _kDartVmSnapshotInstructions
  • _kDartIsolateSnapshotData
  • _kDartIsolateSnapshotInstructions

The shared library should be dynamically loaded by the embedder. Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to Dart_Initialize. The kDartIsolateSnapshotData and kDartIsolateSnapshotInstructions should be passed to Dart_CreateIsolate.

The callback will be invoked one or more times to provide the binary output.

If stripped is true, then the binary output will not include DWARF debugging sections.

If debug_callback_data is provided, debug_callback_data will be used with the callback to provide separate debugging information.

Returns
A valid handle if no error occurs during the operation.

◆ Dart_CreateAppAOTSnapshotAsElfs()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElfs ( Dart_CreateLoadingUnitCallback  next_callback,
void *  next_callback_data,
bool  stripped,
Dart_StreamingWriteCallback  write_callback,
Dart_StreamingCloseCallback  close_callback 
)

◆ Dart_CreateAppJITSnapshotAsBlobs()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppJITSnapshotAsBlobs ( uint8_t **  isolate_snapshot_data_buffer,
intptr_t *  isolate_snapshot_data_size,
uint8_t **  isolate_snapshot_instructions_buffer,
intptr_t *  isolate_snapshot_instructions_size 
)

Creates a snapshot that caches compiled code and type feedback for faster startup and quicker warmup in a subsequent process.

Outputs a snapshot in two pieces. The pieces should be passed to Dart_CreateIsolateGroup in a VM using the same VM snapshot pieces used in the current VM. The instructions piece must be loaded with read and execute permissions; the data piece may be loaded as read-only.

  • Requires the VM to have not been started with –precompilation.
  • Not supported when targeting IA32.
  • The VM writing the snapshot and the VM reading the snapshot must be the same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must be targeting the same architecture, and must both be in checked mode or both in unchecked mode.

The buffers are scope allocated and are only valid until the next call to Dart_ExitScope.

Returns
A valid handle if no error occurs during the operation.

◆ Dart_CreateIsolateGroup()

DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup ( const char *  script_uri,
const char *  name,
const uint8_t *  isolate_snapshot_data,
const uint8_t *  isolate_snapshot_instructions,
Dart_IsolateFlags flags,
void *  isolate_group_data,
void *  isolate_data,
char **  error 
)

Creates a new isolate. The new isolate becomes the current isolate.

A snapshot can be used to restore the VM quickly to a saved state and is useful for fast startup. If snapshot data is provided, the isolate will be started using that snapshot data. Requires a core snapshot or an app snapshot created by Dart_CreateSnapshot or Dart_CreatePrecompiledSnapshot* from a VM with the same version.

Requires there to be no current isolate.

Parameters
script_uriThe main source file or snapshot this isolate will load. The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a child isolate is created by Isolate.spawn. The embedder should use a URI that allows it to load the same program into such a child isolate.
nameA short name for the isolate to improve debugging messages. Typically of the format 'foo.dart:main()'.
isolate_snapshot_dataBuffer containing the snapshot data of the isolate or NULL if no snapshot is provided. If provided, the buffer must remain valid until the isolate shuts down.
isolate_snapshot_instructionsBuffer containing the snapshot instructions of the isolate or NULL if no snapshot is provided. If provided, the buffer must remain valid until the isolate shuts down.
flagsPointer to VM specific flags or NULL for default flags.
isolate_group_dataEmbedder group data. This data can be obtained by calling Dart_IsolateGroupData and will be passed to the Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and Dart_IsolateGroupCleanupCallback.
isolate_dataEmbedder data. This data will be passed to the Dart_IsolateGroupCreateCallback when new isolates are spawned from this parent isolate.
errorReturns NULL if creation is successful, an error message otherwise. The caller is responsible for calling free() on the error message.
Returns
The new isolate on success, or NULL if isolate creation failed.

◆ Dart_CreateIsolateGroupFromKernel()

DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel ( const char *  script_uri,
const char *  name,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size,
Dart_IsolateFlags flags,
void *  isolate_group_data,
void *  isolate_data,
char **  error 
)

Creates a new isolate from a Dart Kernel file. The new isolate becomes the current isolate.

Requires there to be no current isolate.

Parameters
script_uriThe main source file or snapshot this isolate will load. The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a child isolate is created by Isolate.spawn. The embedder should use a URI that allows it to load the same program into such a child isolate.
nameA short name for the isolate to improve debugging messages. Typically of the format 'foo.dart:main()'.
kernel_bufferA buffer which contains a kernel/DIL program. Must remain valid until isolate shutdown.
kernel_buffer_sizeThe size of kernel_buffer.
flagsPointer to VM specific flags or NULL for default flags.
isolate_group_dataEmbedder group data. This data can be obtained by calling Dart_IsolateGroupData and will be passed to the Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and Dart_IsolateGroupCleanupCallback.
isolate_dataEmbedder data. This data will be passed to the Dart_IsolateGroupCreateCallback when new isolates are spawned from this parent isolate.
errorReturns NULL if creation is successful, an error message otherwise. The caller is responsible for calling free() on the error message.
Returns
The new isolate on success, or NULL if isolate creation failed.

◆ Dart_CreateIsolateInGroup()

DART_EXPORT Dart_Isolate Dart_CreateIsolateInGroup ( Dart_Isolate  group_member,
const char *  name,
Dart_IsolateShutdownCallback  shutdown_callback,
Dart_IsolateCleanupCallback  cleanup_callback,
void *  child_isolate_data,
char **  error 
)

Creates a new isolate inside the isolate group of [group_member].

Requires there to be no current isolate.

Parameters
group_memberAn isolate from the same group into which the newly created isolate should be born into. Other threads may not have entered / enter this member isolate.
nameA short name for the isolate for debugging purposes.
shutdown_callbackA callback to be called when the isolate is being shutdown (may be NULL).
cleanup_callbackA callback to be called when the isolate is being cleaned up (may be NULL).
child_isolate_dataThe embedder-specific data associated with this isolate.
errorSet to NULL if creation is successful, set to an error message otherwise. The caller is responsible for calling free() on the error message.
Returns
The newly created isolate on success, or NULL if isolate creation failed.

If successful, the newly created isolate will become the current isolate.

◆ Dart_CreateSnapshot()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateSnapshot ( uint8_t **  vm_snapshot_data_buffer,
intptr_t *  vm_snapshot_data_size,
uint8_t **  isolate_snapshot_data_buffer,
intptr_t *  isolate_snapshot_data_size,
bool  is_core 
)

Creates a full snapshot of the current isolate heap.

A full snapshot is a compact representation of the dart vm isolate heap and dart isolate heap states. These snapshots are used to initialize the vm isolate on startup and fast initialization of an isolate. A Snapshot of the heap is created before any dart code has executed.

Requires there to be a current isolate. Not available in the precompiled runtime (check Dart_IsPrecompiledRuntime).

Parameters
vm_snapshot_data_bufferReturns a pointer to a buffer containing the vm snapshot. This buffer is scope allocated and is only valid until the next call to Dart_ExitScope.
vm_snapshot_data_sizeReturns the size of vm_snapshot_data_buffer.
isolate_snapshot_data_bufferReturns a pointer to a buffer containing the isolate snapshot. This buffer is scope allocated and is only valid until the next call to Dart_ExitScope.
isolate_snapshot_data_sizeReturns the size of isolate_snapshot_data_buffer.
is_coreCreate a snapshot containing core libraries. Such snapshot should be agnostic to null safety mode.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_CreateVMAOTSnapshotAsAssembly()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateVMAOTSnapshotAsAssembly ( Dart_StreamingWriteCallback  callback,
void *  callback_data 
)

Like Dart_CreateAppAOTSnapshotAsAssembly, but only includes kDartVmSnapshotData and kDartVmSnapshotInstructions. It also does not strip DWARF information from the generated assembly or allow for separate debug information.

◆ Dart_CurrentIsolate()

DART_EXPORT Dart_Isolate Dart_CurrentIsolate ( void  )

Returns the current isolate. Will return NULL if there is no current isolate.

◆ Dart_CurrentIsolateData()

DART_EXPORT void * Dart_CurrentIsolateData ( void  )

Returns the callback data associated with the current isolate. This data was set when the isolate got created or initialized.

◆ Dart_CurrentIsolateGroup()

DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup ( void  )

Returns the current isolate group. Will return NULL if there is no current isolate group.

◆ Dart_CurrentIsolateGroupData()

DART_EXPORT void * Dart_CurrentIsolateGroupData ( void  )

Returns the callback data associated with the current isolate group. This data was passed to the isolate group when it was created.

◆ Dart_CurrentIsolateGroupId()

DART_EXPORT Dart_IsolateGroupId Dart_CurrentIsolateGroupId ( void  )

◆ Dart_DebugName()

DART_EXPORT Dart_Handle Dart_DebugName ( void  )

Returns the debugging name for the current isolate.

This name is unique to each isolate and should only be used to make debugging messages more comprehensible.

◆ Dart_DebugNameToCString()

DART_EXPORT const char * Dart_DebugNameToCString ( void  )

Returns the debugging name for the current isolate.

This name is unique to each isolate and should only be used to make debugging messages more comprehensible.

The returned string is scope allocated and is only valid until the next call to Dart_ExitScope.

◆ Dart_DeferredLoadComplete()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_DeferredLoadComplete ( intptr_t  loading_unit_id,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions 
)

Notifies the VM that a deferred load completed successfully. This function will eventually cause the corresponding prefix.loadLibrary() futures to complete.

Requires the current isolate to be the same current isolate during the invocation of the Dart_DeferredLoadHandler.

◆ Dart_DeferredLoadCompleteError()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_DeferredLoadCompleteError ( intptr_t  loading_unit_id,
const char *  error_message,
bool  transient 
)

Notifies the VM that a deferred load failed. This function will eventually cause the corresponding prefix.loadLibrary() futures to complete with an error.

If transient is true, future invocations of prefix.loadLibrary() will trigger new load requests. If false, futures invocation will complete with the same error.

Requires the current isolate to be the same current isolate during the invocation of the Dart_DeferredLoadHandler.

◆ Dart_DeleteFinalizableHandle()

DART_EXPORT void Dart_DeleteFinalizableHandle ( Dart_FinalizableHandle  object,
Dart_Handle  strong_ref_to_object 
)

Deletes the given finalizable [object] handle.

The caller has to provide the actual Dart object the handle was created from to prove the object (and therefore the finalizable handle) is still alive.

Requires there to be a current isolate.

◆ Dart_DeletePersistentHandle()

DART_EXPORT void Dart_DeletePersistentHandle ( Dart_PersistentHandle  object)

Deallocates a persistent handle.

Requires there to be a current isolate group.

◆ Dart_DeleteWeakPersistentHandle()

DART_EXPORT void Dart_DeleteWeakPersistentHandle ( Dart_WeakPersistentHandle  object)

Deletes the given weak persistent [object] handle.

Requires there to be a current isolate group.

◆ Dart_DetectNullSafety()

DART_EXPORT bool Dart_DetectNullSafety ( const char *  script_uri,
const char *  package_config,
const char *  original_working_directory,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)

Always return true as the VM only supports strong null safety.

◆ Dart_DisableHeapSampling()

DART_EXPORT void Dart_DisableHeapSampling ( void  )

◆ Dart_DoubleValue()

DART_EXPORT Dart_Handle Dart_DoubleValue ( Dart_Handle  double_obj,
double *  value 
)

Gets the value of a Double

Parameters
double_objA Double
valueReturns the value of the Double.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_DumpNativeStackTrace()

DART_EXPORT void Dart_DumpNativeStackTrace ( void *  context)

Print a native stack trace. Used for crash handling.

If context is NULL, prints the current stack trace. Otherwise, context should be a CONTEXT* (Windows) or ucontext_t* (POSIX) from a signal handler running on the current thread.

◆ Dart_EmptyString()

DART_EXPORT Dart_Handle Dart_EmptyString ( void  )

Returns the empty string object.

Returns
A handle to the empty string object.

◆ Dart_EnableHeapSampling()

DART_EXPORT void Dart_EnableHeapSampling ( void  )

Starts the heap sampling profiler for each thread in the VM.

◆ Dart_EnterIsolate()

DART_EXPORT void Dart_EnterIsolate ( Dart_Isolate  isolate)

Enters an isolate. After calling this function, the current isolate will be set to the provided isolate.

Requires there to be no current isolate. Multiple threads may not be in the same isolate at once.

◆ Dart_EnterScope()

DART_EXPORT void Dart_EnterScope ( void  )

Enters a new scope.

All new local handles will be created in this scope. Additionally, some functions may return "scope allocated" memory which is only valid within this scope.

Requires there to be a current isolate.

◆ Dart_ErrorGetException()

DART_EXPORT Dart_Handle Dart_ErrorGetException ( Dart_Handle  handle)

Gets the exception Object from an unhandled exception error handle.

◆ Dart_ErrorGetStackTrace()

DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace ( Dart_Handle  handle)

Gets the stack trace Object from an unhandled exception error handle.

◆ Dart_ErrorHasException()

DART_EXPORT bool Dart_ErrorHasException ( Dart_Handle  handle)

Is this an error handle for an unhandled exception?

◆ Dart_ExitIsolate()

DART_EXPORT void Dart_ExitIsolate ( void  )

Exits an isolate. After this call, Dart_CurrentIsolate will return NULL.

Requires there to be a current isolate.

◆ Dart_ExitScope()

DART_EXPORT void Dart_ExitScope ( void  )

Exits a scope.

The previous scope (if any) becomes the current scope.

Requires there to be a current isolate.

◆ Dart_False()

DART_EXPORT Dart_Handle Dart_False ( void  )

Returns the False object.

Requires there to be a current isolate.

Returns
A handle to the False object.

◆ Dart_FinalizeLoading()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_FinalizeLoading ( bool  complete_futures)

Indicates that all outstanding load requests have been satisfied. This finalizes all the new classes loaded and optionally completes deferred library futures.

Requires there to be a current isolate.

Parameters
complete_futuresSpecify true if all deferred library futures should be completed, false otherwise.
Returns
Success if all classes have been finalized and deferred library futures are completed. Otherwise, returns an error.

◆ Dart_FunctionIsStatic()

DART_EXPORT Dart_Handle Dart_FunctionIsStatic ( Dart_Handle  function,
bool *  is_static 
)

Determines whether a function handle refers to a static function of method.

For the purposes of the embedding API, a top-level function is implicitly declared static.

Parameters
functionA handle to a function or method declaration.
is_staticReturns whether the function or method is declared static.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_FunctionName()

DART_EXPORT Dart_Handle Dart_FunctionName ( Dart_Handle  function)

Returns the name for the provided function or method.

Returns
A valid string handle if no error occurs during the operation.

◆ Dart_FunctionOwner()

DART_EXPORT Dart_Handle Dart_FunctionOwner ( Dart_Handle  function)

Returns a handle to the owner of a function.

The owner of an instance method or a static method is its defining class. The owner of a top-level function is its defining library. The owner of the function of a non-implicit closure is the function of the method or closure that defines the non-implicit closure.

Returns
A valid handle to the owner of the function, or an error handle if the argument is not a valid handle to a function.

◆ Dart_GetClass()

DART_EXPORT Dart_Handle Dart_GetClass ( Dart_Handle  library,
Dart_Handle  class_name 
)

Lookup a class or interface by name from a Library.

Parameters
libraryThe library containing the class or interface.
class_nameThe name of the class or interface.
Returns
If no error occurs, the class or interface is returned. Otherwise an error handle is returned.

◆ Dart_GetDataFromByteBuffer()

DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer ( Dart_Handle  byte_buffer)

Returns the TypedData object associated with the ByteBuffer object.

Parameters
byte_bufferThe ByteBuffer object.
Returns
The TypedData object if no error occurs. Otherwise returns an error handle.

◆ Dart_GetError()

DART_EXPORT const char * Dart_GetError ( Dart_Handle  handle)

Gets the error message from an error handle.

Requires there to be a current isolate.

Returns
A C string containing an error message if the handle is error. An empty C string ("") if the handle is valid. This C String is scope allocated and is only valid until the next call to Dart_ExitScope.

◆ Dart_GetField()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField ( Dart_Handle  container,
Dart_Handle  name 
)

Gets the value of a field.

The 'container' parameter may be an object, type, or library. If 'container' is an object, then this function will access an instance field. If 'container' is a type, then this function will access a static field. If 'container' is a library, then this function will access a top-level variable. NOTE: This API call cannot be used to access fields of a type object.

This function ignores field visibility (leading underscores in names).

May generate an unhandled exception error.

Parameters
containerAn object, type, or library.
nameA field name.
Returns
If no error occurs, then the value of the field is returned. Otherwise an error handle is returned.

◆ Dart_GetLoadedLibraries()

DART_EXPORT Dart_Handle Dart_GetLoadedLibraries ( void  )
Returns
An array of libraries.

◆ Dart_GetMainPortId()

DART_EXPORT Dart_Port Dart_GetMainPortId ( void  )

Gets the main port id for the current isolate.

◆ Dart_GetMessageNotifyCallback()

DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback ( void  )

Query the current message notify callback for the isolate.

Returns
The current message notify callback for the isolate.

◆ Dart_GetNativeArgument()

DART_EXPORT Dart_Handle Dart_GetNativeArgument ( Dart_NativeArguments  args,
int  index 
)

Gets the native argument at some index.

◆ Dart_GetNativeArgumentCount()

DART_EXPORT int Dart_GetNativeArgumentCount ( Dart_NativeArguments  args)

Gets the number of native arguments.

◆ Dart_GetNativeArguments()

DART_EXPORT Dart_Handle Dart_GetNativeArguments ( Dart_NativeArguments  args,
int  num_arguments,
const Dart_NativeArgument_Descriptor arg_descriptors,
Dart_NativeArgument_Value arg_values 
)

Gets the native arguments based on the types passed in and populates the passed arguments buffer with appropriate native values.

Parameters
argsthe Native arguments block passed into the native call.
num_argumentslength of argument descriptor array and argument values array passed in.
arg_descriptorsan array that describes the arguments that need to be retrieved. For each argument to be retrieved the descriptor contains the argument number (0, 1 etc.) and the argument type described using Dart_NativeArgument_Type, e.g: DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kBool, 1) indicates that the first argument is to be retrieved and it should be a boolean.
arg_valuesarray into which the native arguments need to be extracted into, the array is allocated by the caller (it could be stack allocated to avoid the malloc/free performance overhead).
Returns
Success if all the arguments could be extracted correctly, returns an error handle if there were any errors while extracting the arguments (mismatched number of arguments, incorrect types, etc.).

◆ Dart_GetNativeBooleanArgument()

DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument ( Dart_NativeArguments  args,
int  index,
bool *  value 
)

Gets a boolean native argument at some index.

Parameters
argsNative arguments structure.
indexIndex of the desired argument in the structure above.
valueReturns the boolean value if the argument is a Boolean.
Returns
Success if no error occurs. Otherwise returns an error handle.

◆ Dart_GetNativeDoubleArgument()

DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument ( Dart_NativeArguments  args,
int  index,
double *  value 
)

Gets a double native argument at some index.

Parameters
argsNative arguments structure.
indexIndex of the desired argument in the structure above.
valueReturns the double value if the argument is a double.
Returns
Success if no error occurs. Otherwise returns an error handle.

◆ Dart_GetNativeFieldsOfArgument()

DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument ( Dart_NativeArguments  args,
int  arg_index,
int  num_fields,
intptr_t *  field_values 
)

Gets all the native fields of the native argument at some index.

Parameters
argsNative arguments structure.
arg_indexIndex of the desired argument in the structure above.
num_fieldssize of the intptr_t array 'field_values' passed in.
field_valuesintptr_t array in which native field values are returned.
Returns
Success if the native fields where copied in successfully. Otherwise returns an error handle. On success the native field values are copied into the 'field_values' array, if the argument at 'arg_index' is a null object then 0 is copied as the native field values into the 'field_values' array.

◆ Dart_GetNativeInstanceField()

DART_EXPORT Dart_Handle Dart_GetNativeInstanceField ( Dart_Handle  obj,
int  index,
intptr_t *  value 
)

Gets the value of a native field.

TODO(turnidge): Document.

◆ Dart_GetNativeInstanceFieldCount()

DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount ( Dart_Handle  obj,
int count 
)

Gets the number of native instance fields in an object.

◆ Dart_GetNativeIntegerArgument()

DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument ( Dart_NativeArguments  args,
int  index,
int64_t *  value 
)

Gets an integer native argument at some index.

Parameters
argsNative arguments structure.
indexIndex of the desired argument in the structure above.
valueReturns the integer value if the argument is an Integer.
Returns
Success if no error occurs. Otherwise returns an error handle.

◆ Dart_GetNativeIsolateGroupData()

DART_EXPORT void * Dart_GetNativeIsolateGroupData ( Dart_NativeArguments  args)

Extracts current isolate group data from the native arguments structure.

◆ Dart_GetNativeReceiver()

DART_EXPORT Dart_Handle Dart_GetNativeReceiver ( Dart_NativeArguments  args,
intptr_t *  value 
)

Gets the native field of the receiver.

◆ Dart_GetNativeResolver()

DART_EXPORT Dart_Handle Dart_GetNativeResolver ( Dart_Handle  library,
Dart_NativeEntryResolver resolver 
)

Returns the callback used to resolve native functions for a library.

Parameters
libraryA library.
resolvera pointer to a Dart_NativeEntryResolver
Returns
A valid handle if the library was found.

◆ Dart_GetNativeStringArgument()

DART_EXPORT Dart_Handle Dart_GetNativeStringArgument ( Dart_NativeArguments  args,
int  arg_index,
void **  peer 
)

Gets a string native argument at some index.

Parameters
argsNative arguments structure.
arg_indexIndex of the desired argument in the structure above.
peerReturns the peer pointer if the string argument has one.
Returns
Success if the string argument has a peer, if it does not have a peer then the String object is returned. Otherwise returns an error handle (argument is not a String object).

◆ Dart_GetNativeSymbol()

DART_EXPORT Dart_Handle Dart_GetNativeSymbol ( Dart_Handle  library,
Dart_NativeEntrySymbol resolver 
)

Returns the callback used to resolve native function symbols for a library.

Parameters
libraryA library.
resolvera pointer to a Dart_NativeEntrySymbol.
Returns
A valid handle if the library was found.

◆ Dart_GetNonNullableType()

DART_EXPORT Dart_Handle Dart_GetNonNullableType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Lookup or instantiate a non-nullable type by name and type arguments from Library.

Parameters
libraryThe library containing the class or interface.
class_nameThe class name for the type.
number_of_type_argumentsNumber of type arguments. For non parametric types the number of type arguments would be 0.
type_argumentsPointer to an array of type arguments. For non parametric types a NULL would be passed in for this argument.
Returns
If no error occurs, the type is returned. Otherwise an error handle is returned.

◆ Dart_GetNullableType()

DART_EXPORT Dart_Handle Dart_GetNullableType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Lookup or instantiate a nullable type by name and type arguments from Library.

Parameters
libraryThe library containing the class or interface.
class_nameThe class name for the type.
number_of_type_argumentsNumber of type arguments. For non parametric types the number of type arguments would be 0.
type_argumentsPointer to an array of type arguments. For non parametric types a NULL would be passed in for this argument.
Returns
If no error occurs, the type is returned. Otherwise an error handle is returned.

◆ Dart_GetObfuscationMap()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetObfuscationMap ( uint8_t **  buffer,
intptr_t *  buffer_length 
)

Get obfuscation map for precompiled code.

Obfuscation map is encoded as a JSON array of pairs (original name, obfuscated name).

Returns
Returns an error handler if the VM was built in a mode that does not support obfuscation.

◆ Dart_GetPeer()

DART_EXPORT Dart_Handle Dart_GetPeer ( Dart_Handle  object,
void **  peer 
)

The peer field is a lazily allocated field intended for storage of an uncommonly used values. Most instances types can have a peer field allocated. The exceptions are subtypes of Null, num, and bool. Returns the value of peer field of 'object' in 'peer'.

Parameters
objectAn object.
peerAn out parameter that returns the value of the peer field.
Returns
Returns an error if 'object' is a subtype of Null, num, or bool.

◆ Dart_GetStaticMethodClosure()

DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure ( Dart_Handle  library,
Dart_Handle  cls_type,
Dart_Handle  function_name 
)

Returns a closure of static function 'function_name' in the class 'class_name' in the exported namespace of specified 'library'.

Parameters
libraryLibrary object
cls_typeType object representing a Class
function_nameName of the static function in the class
Returns
A valid Dart instance if no error occurs during the operation.

◆ Dart_GetStickyError()

DART_EXPORT Dart_Handle Dart_GetStickyError ( void  )

Gets the sticky error for the current isolate.

Returns
A handle to the sticky error object or null.

◆ Dart_GetType()

DART_EXPORT Dart_Handle Dart_GetType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Lookup or instantiate a legacy type by name and type arguments from a Library.

Parameters
libraryThe library containing the class or interface.
class_nameThe class name for the type.
number_of_type_argumentsNumber of type arguments. For non parametric types the number of type arguments would be 0.
type_argumentsPointer to an array of type arguments. For non parametric types a NULL would be passed in for this argument.
Returns
If no error occurs, the type is returned. Otherwise an error handle is returned.

◆ Dart_GetTypeOfExternalTypedData()

DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData ( Dart_Handle  object)

Return type if this object is an external TypedData object.

Returns
kInvalid if the object is not an external TypedData object or the appropriate Dart_TypedData_Type.

◆ Dart_GetTypeOfTypedData()

DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData ( Dart_Handle  object)

Return type if this object is a TypedData object.

Returns
kInvalid if the object is not a TypedData object or the appropriate Dart_TypedData_Type.

◆ Dart_HandleFromPersistent()

DART_EXPORT Dart_Handle Dart_HandleFromPersistent ( Dart_PersistentHandle  object)

Allocates a handle in the current scope from a persistent handle.

◆ Dart_HandleFromWeakPersistent()

DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent ( Dart_WeakPersistentHandle  object)

Allocates a handle in the current scope from a weak persistent handle.

This will be a handle to Dart_Null if the object has been garbage collected.

◆ Dart_HandleMessage()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_HandleMessage ( void  )

Handles the next pending message for the current isolate.

May generate an unhandled exception error.

Returns
A valid handle if no error occurs during the operation.

◆ Dart_HandleServiceMessages()

DART_EXPORT bool Dart_HandleServiceMessages ( void  )

Handles any pending messages for the vm service for the current isolate.

This function may be used by an embedder at a breakpoint to avoid pausing the vm service.

This function can indirectly cause the message notify callback to be called.

Returns
true if the vm service requests the program resume execution, false otherwise

◆ Dart_HasLivePorts()

DART_EXPORT bool Dart_HasLivePorts ( void  )

Does the current isolate have live ReceivePorts?

A ReceivePort is live when it has not been closed.

◆ Dart_HasServiceMessages()

DART_EXPORT bool Dart_HasServiceMessages ( void  )

Does the current isolate have pending service messages?

Returns
true if the isolate has pending service messages, false otherwise.

◆ Dart_HasStickyError()

DART_EXPORT bool Dart_HasStickyError ( void  )

Does the current isolate have a sticky error?

◆ Dart_IdentityEquals()

DART_EXPORT bool Dart_IdentityEquals ( Dart_Handle  obj1,
Dart_Handle  obj2 
)

Checks to see if two handles refer to identically equal objects.

If both handles refer to instances, this is equivalent to using the top-level function identical() from dart:core. Otherwise, returns whether the two argument handles refer to the same object.

Parameters
obj1An object to be compared.
obj2An object to be compared.
Returns
True if the objects are identically equal. False otherwise.

◆ Dart_Initialize()

DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Initialize ( Dart_InitializeParams params)

Initializes the VM.

Parameters
paramsA struct containing initialization information. The version field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
Returns
NULL if initialization is successful. Returns an error message otherwise. The caller is responsible for freeing the error message.

◆ Dart_InitializeNativeAssetsResolver()

DART_EXPORT void Dart_InitializeNativeAssetsResolver ( NativeAssetsApi native_assets_api)

Initializes native asset resolution for the current isolate group.

The caller is responsible for ensuring this is called right after isolate group creation, and before running any dart code (or spawning isolates).

Parameters
native_assets_apiThe callbacks used by native assets resolution. The VM does not take ownership of the parameter, it can be freed immediately after the call.

◆ Dart_InstanceGetType()

DART_EXPORT Dart_Handle Dart_InstanceGetType ( Dart_Handle  instance)

Gets the type of a Dart language object.

Parameters
instanceSome Dart object.
Returns
If no error occurs, the type is returned. Otherwise an error handle is returned.

◆ Dart_IntegerFitsIntoInt64()

DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64 ( Dart_Handle  integer,
bool *  fits 
)

Does this Integer fit into a 64-bit signed integer?

Parameters
integerAn integer.
fitsReturns true if the integer fits into a 64-bit signed integer.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_IntegerFitsIntoUint64()

DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64 ( Dart_Handle  integer,
bool *  fits 
)

Does this Integer fit into a 64-bit unsigned integer?

Parameters
integerAn integer.
fitsReturns true if the integer fits into a 64-bit unsigned integer.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_IntegerToHexCString()

DART_EXPORT Dart_Handle Dart_IntegerToHexCString ( Dart_Handle  integer,
const char **  value 
)

Gets the value of an integer as a hexadecimal C string.

Parameters
integerAn Integer.
valueReturns the value of the Integer as a hexadecimal C string. This C string is scope allocated and is only valid until the next call to Dart_ExitScope.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_IntegerToInt64()

DART_EXPORT Dart_Handle Dart_IntegerToInt64 ( Dart_Handle  integer,
int64_t *  value 
)

Gets the value of an Integer.

The integer must fit into a 64-bit signed integer, otherwise an error occurs.

Parameters
integerAn Integer.
valueReturns the value of the Integer.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_IntegerToUint64()

DART_EXPORT Dart_Handle Dart_IntegerToUint64 ( Dart_Handle  integer,
uint64_t *  value 
)

Gets the value of an Integer.

The integer must fit into a 64-bit unsigned integer, otherwise an error occurs.

Parameters
integerAn Integer.
valueReturns the value of the Integer.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_Invoke()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Invoke ( Dart_Handle  target,
Dart_Handle  name,
int  number_of_arguments,
Dart_Handle arguments 
)

Invokes a method or function.

The 'target' parameter may be an object, type, or library. If 'target' is an object, then this function will invoke an instance method. If 'target' is a type, then this function will invoke a static method. If 'target' is a library, then this function will invoke a top-level function from that library. NOTE: This API call cannot be used to invoke methods of a type object.

This function ignores visibility (leading underscores in names).

May generate an unhandled exception error.

Parameters
targetAn object, type, or library.
nameThe name of the function or method to invoke.
number_of_argumentsSize of the arguments array.
argumentsAn array of arguments to the function.
Returns
If the function or method is called and completes successfully, then the return value is returned. If an error occurs during execution, then an error handle is returned.

◆ Dart_InvokeClosure()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeClosure ( Dart_Handle  closure,
int  number_of_arguments,
Dart_Handle arguments 
)

Invokes a Closure with the given arguments.

May generate an unhandled exception error.

Returns
If no error occurs during execution, then the result of invoking the closure is returned. If an error occurs during execution, then an error handle is returned.

◆ Dart_InvokeConstructor()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeConstructor ( Dart_Handle  object,
Dart_Handle  name,
int  number_of_arguments,
Dart_Handle arguments 
)

Invokes a Generative Constructor on an object that was previously allocated using Dart_Allocate/Dart_AllocateWithNativeFields.

The 'object' parameter must be an object.

This function ignores visibility (leading underscores in names).

May generate an unhandled exception error.

Parameters
objectAn object.
nameThe name of the constructor to invoke. Use Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor.
number_of_argumentsSize of the arguments array.
argumentsAn array of arguments to the function.
Returns
If the constructor is called and completes successfully, then the object is returned. If an error occurs during execution, then an error handle is returned.

◆ Dart_IsApiError()

DART_EXPORT bool Dart_IsApiError ( Dart_Handle  handle)

Is this an api error handle?

Api error handles are produced when an api function is misused. This happens when a Dart embedding api function is called with invalid arguments or in an invalid context.

Requires there to be a current isolate.

◆ Dart_IsBoolean()

DART_EXPORT bool Dart_IsBoolean ( Dart_Handle  object)

◆ Dart_IsByteBuffer()

DART_EXPORT bool Dart_IsByteBuffer ( Dart_Handle  object)

◆ Dart_IsClosure()

DART_EXPORT bool Dart_IsClosure ( Dart_Handle  object)

◆ Dart_IsCompilationError()

DART_EXPORT bool Dart_IsCompilationError ( Dart_Handle  handle)

Is this a compilation error handle?

Compilation error handles are produced when, during the execution of Dart code, a compile-time error occurs. This can occur in any function which triggers the execution of Dart code.

Requires there to be a current isolate.

◆ Dart_IsDouble()

DART_EXPORT bool Dart_IsDouble ( Dart_Handle  object)

◆ Dart_IsError()

DART_EXPORT bool Dart_IsError ( Dart_Handle  handle)

Is this an error handle?

Requires there to be a current isolate.

◆ Dart_IsFatalError()

DART_EXPORT bool Dart_IsFatalError ( Dart_Handle  handle)

Is this a fatal error handle?

Fatal error handles are produced when the system wants to shut down the current isolate.

Requires there to be a current isolate.

◆ Dart_IsFunction()

DART_EXPORT bool Dart_IsFunction ( Dart_Handle  handle)

◆ Dart_IsFuture()

DART_EXPORT bool Dart_IsFuture ( Dart_Handle  object)

◆ Dart_IsInstance()

DART_EXPORT bool Dart_IsInstance ( Dart_Handle  object)

Query object type.

Parameters
objectSome Object.
Returns
true if Object is of the specified type.

◆ Dart_IsInteger()

DART_EXPORT bool Dart_IsInteger ( Dart_Handle  object)

◆ Dart_IsKernel()

DART_EXPORT bool Dart_IsKernel ( const uint8_t *  buffer,
intptr_t  buffer_size 
)

Returns whether the buffer contains a kernel file.

Parameters
bufferPointer to a buffer that might contain a kernel binary.
buffer_sizeSize of the buffer.
Returns
Whether the buffer contains a kernel binary (full or partial).

◆ Dart_IsKernelIsolate()

DART_EXPORT bool Dart_IsKernelIsolate ( Dart_Isolate  isolate)

◆ Dart_IsLibrary()

DART_EXPORT bool Dart_IsLibrary ( Dart_Handle  object)

◆ Dart_IsList()

DART_EXPORT bool Dart_IsList ( Dart_Handle  object)

◆ Dart_IsMap()

DART_EXPORT bool Dart_IsMap ( Dart_Handle  object)

◆ Dart_IsNonNullableType()

DART_EXPORT Dart_Handle Dart_IsNonNullableType ( Dart_Handle  type,
bool *  result 
)

◆ Dart_IsNull()

DART_EXPORT bool Dart_IsNull ( Dart_Handle  object)

Is this object null?

◆ Dart_IsNullableType()

DART_EXPORT Dart_Handle Dart_IsNullableType ( Dart_Handle  type,
bool *  result 
)

A type's nullability.

Parameters
typeA Dart type.
resultAn out parameter containing the result of the check. True if the type is of the specified nullability, false otherwise.
Returns
Returns an error handle if type is not of type Type.

◆ Dart_IsNumber()

DART_EXPORT bool Dart_IsNumber ( Dart_Handle  object)

◆ Dart_IsolateData()

DART_EXPORT void * Dart_IsolateData ( Dart_Isolate  isolate)

Returns the callback data associated with the given isolate. This data was set when the isolate got created or initialized.

◆ Dart_IsolateFlagsInitialize()

DART_EXPORT void Dart_IsolateFlagsInitialize ( Dart_IsolateFlags flags)

Initialize Dart_IsolateFlags with correct version and default values.

◆ Dart_IsolateGroupData()

DART_EXPORT void * Dart_IsolateGroupData ( Dart_Isolate  isolate)

Returns the callback data associated with the specified isolate group. This data was passed to the isolate when it was created. The embedder is responsible for ensuring the consistency of this data with respect to the lifecycle of an isolate group.

◆ Dart_IsolateMakeRunnable()

DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_IsolateMakeRunnable ( Dart_Isolate  isolate)

Make isolate runnable.

When isolates are spawned, this function is used to indicate that the creation and initialization (including script loading) of the isolate is complete and the isolate can start. This function expects there to be no current isolate.

Parameters
isolateThe isolate to be made runnable.
Returns
NULL if successful. Returns an error message otherwise. The caller is responsible for freeing the error message.

◆ Dart_IsolateServiceId()

DART_EXPORT const char * Dart_IsolateServiceId ( Dart_Isolate  isolate)

Returns the ID for an isolate which is used to query the service protocol.

It is the responsibility of the caller to free the returned ID.

◆ Dart_IsPausedOnExit()

DART_EXPORT bool Dart_IsPausedOnExit ( void  )

Is the current isolate paused on exit?

Returns
A boolean value indicating if the isolate is paused on exit.

◆ Dart_IsPausedOnStart()

DART_EXPORT bool Dart_IsPausedOnStart ( void  )

Is the current isolate paused on start?

Returns
A boolean value indicating if the isolate is paused on start.

◆ Dart_IsPrecompiledRuntime()

DART_EXPORT bool Dart_IsPrecompiledRuntime ( void  )

Returns whether the VM only supports running from precompiled snapshots and not from any other kind of snapshot or from source (that is, the VM was compiled with DART_PRECOMPILED_RUNTIME).

◆ Dart_IsServiceIsolate()

DART_EXPORT bool Dart_IsServiceIsolate ( Dart_Isolate  isolate)

Returns true if isolate is the service isolate.

Parameters
isolateAn isolate
Returns
Returns true if 'isolate' is the service isolate.

◆ Dart_IsString()

DART_EXPORT bool Dart_IsString ( Dart_Handle  object)

◆ Dart_IsStringLatin1()

DART_EXPORT bool Dart_IsStringLatin1 ( Dart_Handle  object)

◆ Dart_IsTearOff()

DART_EXPORT bool Dart_IsTearOff ( Dart_Handle  object)

Is this object a closure resulting from a tear-off (closurized method)?

Returns true for closures produced when an ordinary method is accessed through a getter call. Returns false otherwise, in particular for closures produced from local function declarations.

Parameters
objectSome Object.
Returns
true if Object is a tear-off.

◆ Dart_IsType()

DART_EXPORT bool Dart_IsType ( Dart_Handle  handle)

◆ Dart_IsTypedData()

DART_EXPORT bool Dart_IsTypedData ( Dart_Handle  object)

◆ Dart_IsTypeVariable()

DART_EXPORT bool Dart_IsTypeVariable ( Dart_Handle  handle)

◆ Dart_IsUnhandledExceptionError()

DART_EXPORT bool Dart_IsUnhandledExceptionError ( Dart_Handle  handle)

Is this an unhandled exception error handle?

Unhandled exception error handles are produced when, during the execution of Dart code, an exception is thrown but not caught. This can occur in any function which triggers the execution of Dart code.

See Dart_ErrorGetException and Dart_ErrorGetStackTrace.

Requires there to be a current isolate.

◆ Dart_IsVariable()

DART_EXPORT bool Dart_IsVariable ( Dart_Handle  handle)

◆ Dart_IsVMFlagSet()

DART_EXPORT bool Dart_IsVMFlagSet ( const char *  flag_name)

Returns true if the named VM flag is of boolean type, specified, and set to true.

Parameters
flag_nameThe name of the flag without leading punctuation (example: "enable_asserts").

◆ Dart_KernelIsolateIsRunning()

DART_EXPORT bool Dart_KernelIsolateIsRunning ( void  )

◆ Dart_KernelListDependencies()

DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies ( void  )

◆ Dart_KernelPort()

DART_EXPORT Dart_Port Dart_KernelPort ( void  )

◆ Dart_KillIsolate()

DART_EXPORT void Dart_KillIsolate ( Dart_Isolate  isolate)

Kills the given isolate.

This function has the same effect as dart:isolate's Isolate.kill(priority:immediate). It can interrupt ordinary Dart code but not native code. If the isolate is in the middle of a long running native function, the isolate will not be killed until control returns to Dart.

Does not require a current isolate. It is safe to kill the current isolate if there is one.

◆ Dart_LibraryHandleError()

DART_EXPORT Dart_Handle Dart_LibraryHandleError ( Dart_Handle  library,
Dart_Handle  error 
)

Report an loading error for the library.

Parameters
libraryThe library that failed to load.
errorThe Dart error instance containing the load error.
Returns
If the VM handles the error, the return value is a null handle. If it doesn't handle the error, the error object is returned.

◆ Dart_LibraryResolvedUrl()

DART_EXPORT Dart_Handle Dart_LibraryResolvedUrl ( Dart_Handle  library)

Returns a URL from which a Library was loaded.

◆ Dart_LibraryUrl()

DART_EXPORT Dart_Handle Dart_LibraryUrl ( Dart_Handle  library)

Returns an import path to a Library, such as "file:///test.dart" or "dart:core".

◆ Dart_ListGetAsBytes()

DART_EXPORT Dart_Handle Dart_ListGetAsBytes ( Dart_Handle  list,
intptr_t  offset,
uint8_t *  native_array,
intptr_t  length 
)

May generate an unhandled exception error.

◆ Dart_ListGetAt()

DART_EXPORT Dart_Handle Dart_ListGetAt ( Dart_Handle  list,
intptr_t  index 
)

Gets the Object at some index of a List.

If the index is out of bounds, an error occurs.

May generate an unhandled exception error.

Parameters
listA List.
indexA valid index into the List.
Returns
The Object in the List at the specified index if no error occurs. Otherwise returns an error handle.

◆ Dart_ListGetRange()

DART_EXPORT Dart_Handle Dart_ListGetRange ( Dart_Handle  list,
intptr_t  offset,
intptr_t  length,
Dart_Handle result 
)

Gets a range of Objects from a List.

If any of the requested index values are out of bounds, an error occurs.

May generate an unhandled exception error.

Parameters
listA List.
offsetThe offset of the first item to get.
lengthThe number of items to get.
resultA pointer to fill with the objects.
Returns
Success if no error occurs during the operation.

◆ Dart_ListLength()

DART_EXPORT Dart_Handle Dart_ListLength ( Dart_Handle  list,
intptr_t *  length 
)

Gets the length of a List.

May generate an unhandled exception error.

Parameters
listA List.
lengthReturns the length of the List.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_ListSetAsBytes()

DART_EXPORT Dart_Handle Dart_ListSetAsBytes ( Dart_Handle  list,
intptr_t  offset,
const uint8_t *  native_array,
intptr_t  length 
)

May generate an unhandled exception error.

◆ Dart_ListSetAt()

DART_EXPORT Dart_Handle Dart_ListSetAt ( Dart_Handle  list,
intptr_t  index,
Dart_Handle  value 
)

Sets the Object at some index of a List.

If the index is out of bounds, an error occurs.

May generate an unhandled exception error.

Parameters
listA List.
indexA valid index into the List.
valueThe Object to put in the List.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_LoadingUnitLibraryUris()

DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris ( intptr_t  loading_unit_id)

◆ Dart_LoadLibrary()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibrary ( Dart_Handle  kernel_buffer)

◆ Dart_LoadLibraryFromKernel()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibraryFromKernel ( const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)

Called by the embedder to load a partial program. Does not set the root library.

Parameters
kernel_bufferA buffer which contains a kernel binary (see pkg/kernel/binary.md). Must remain valid until isolate shutdown.
kernel_buffer_sizeLength of the passed in buffer.
Returns
A handle to the main library of the compilation unit, or an error.

◆ Dart_LoadScriptFromKernel()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadScriptFromKernel ( const uint8_t *  kernel_buffer,
intptr_t  kernel_size 
)

Loads the root library for the current isolate.

Requires there to be no current root library.

Parameters
kernel_bufferA buffer which contains a kernel binary (see pkg/kernel/binary.md). Must remain valid until isolate group shutdown.
kernel_sizeLength of the passed in buffer.
Returns
A handle to the root library, or an error.

◆ Dart_LookupLibrary()

DART_EXPORT Dart_Handle Dart_LookupLibrary ( Dart_Handle  url)

◆ Dart_MapContainsKey()

DART_EXPORT Dart_Handle Dart_MapContainsKey ( Dart_Handle  map,
Dart_Handle  key 
)

Returns whether the Map contains a given key.

May generate an unhandled exception error.

Parameters
mapA Map.
Returns
A handle on a boolean indicating whether map contains the key. Otherwise returns an error handle.

◆ Dart_MapGetAt()

DART_EXPORT Dart_Handle Dart_MapGetAt ( Dart_Handle  map,
Dart_Handle  key 
)

Gets the Object at some key of a Map.

May generate an unhandled exception error.

Parameters
mapA Map.
keyAn Object.
Returns
The value in the map at the specified key, null if the map does not contain the key, or an error handle.

◆ Dart_MapKeys()

DART_EXPORT Dart_Handle Dart_MapKeys ( Dart_Handle  map)

Gets the list of keys of a Map.

May generate an unhandled exception error.

Parameters
mapA Map.
Returns
The list of key Objects if no error occurs. Otherwise returns an error handle.

◆ Dart_New()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_New ( Dart_Handle  type,
Dart_Handle  constructor_name,
int  number_of_arguments,
Dart_Handle arguments 
)

Invokes a constructor, creating a new object.

This function allows hidden constructors (constructors with leading underscores) to be called.

Parameters
typeType of object to be constructed.
constructor_nameThe name of the constructor to invoke. Use Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor. This name should not include the name of the class.
number_of_argumentsSize of the arguments array.
argumentsAn array of arguments to the constructor.
Returns
If the constructor is called and completes successfully, then the new object. If an error occurs during execution, then an error handle is returned.

◆ Dart_NewApiError()

DART_EXPORT Dart_Handle Dart_NewApiError ( const char *  error)

Produces an api error handle with the provided error message.

Requires there to be a current isolate.

Parameters
errorthe error message.

◆ Dart_NewBoolean()

DART_EXPORT Dart_Handle Dart_NewBoolean ( bool  value)

Returns a Boolean with the provided value.

Parameters
valuetrue or false.
Returns
The Boolean object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewByteBuffer()

DART_EXPORT Dart_Handle Dart_NewByteBuffer ( Dart_Handle  typed_data)

Returns a ByteBuffer object for the typed data.

Parameters
typed_dataThe TypedData object.
Returns
The ByteBuffer object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewCompilationError()

DART_EXPORT Dart_Handle Dart_NewCompilationError ( const char *  error)

◆ Dart_NewDouble()

DART_EXPORT Dart_Handle Dart_NewDouble ( double  value)

Returns a Double with the provided value.

Parameters
valueA double.
Returns
The Double object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewExternalTypedData()

DART_EXPORT Dart_Handle Dart_NewExternalTypedData ( Dart_TypedData_Type  type,
void *  data,
intptr_t  length 
)

Returns a TypedData object which references an external data array.

Parameters
typeThe type of the data array.
dataA data array. This array must not move.
lengthThe length of the data array (length in type units).
Returns
The TypedData object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewExternalTypedDataWithFinalizer()

DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer ( Dart_TypedData_Type  type,
void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Returns a TypedData object which references an external data array.

Parameters
typeThe type of the data array.
dataA data array. This array must not move.
lengthThe length of the data array (length in type units).
peerA pointer to a native object or NULL. This value is provided to callback when it is invoked.
external_allocation_sizeThe number of externally allocated bytes for peer. Used to inform the garbage collector.
callbackA function pointer that will be invoked sometime after the object is garbage collected, unless the handle has been deleted. A valid callback needs to be specified it cannot be NULL.
Returns
The TypedData object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewFinalizableHandle()

DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle ( Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Allocates a finalizable handle for an object.

This handle has the lifetime of the current isolate group unless the object pointed to by the handle is garbage collected, in this case the VM automatically deletes the handle after invoking the callback associated with the handle. The handle can also be explicitly deallocated by calling Dart_DeleteFinalizableHandle.

If the object becomes unreachable the callback is invoked with the the peer as argument. The callback can be executed on any thread, will have an isolate group, but will not have a current isolate. The callback can only call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle. This gives the embedder the ability to cleanup data associated with the object and clear out any cached references to the handle. All references to this handle after the callback will be invalid. It is illegal to call into the VM with any other Dart_* functions from the callback. If the handle is deleted before the object becomes unreachable, the callback is never invoked.

Requires there to be a current isolate.

Parameters
objectAn object with identity.
peerA pointer to a native object or NULL. This value is provided to callback when it is invoked.
external_allocation_sizeThe number of externally allocated bytes for peer. Used to inform the garbage collector.
callbackA function pointer that will be invoked sometime after the object is garbage collected, unless the handle has been deleted. A valid callback needs to be specified it cannot be NULL.
Returns
The finalizable handle or NULL. NULL is returned in case of bad parameters.

◆ Dart_NewInteger()

DART_EXPORT Dart_Handle Dart_NewInteger ( int64_t  value)

Returns an Integer with the provided value.

Parameters
valueThe value of the integer.
Returns
The Integer object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewIntegerFromHexCString()

DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString ( const char *  value)

Returns an Integer with the provided value.

Parameters
valueThe value of the integer represented as a C string containing a hexadecimal number.
Returns
The Integer object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewIntegerFromUint64()

DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64 ( uint64_t  value)

Returns an Integer with the provided value.

Parameters
valueThe unsigned value of the integer.
Returns
The Integer object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewList()

DART_EXPORT Dart_Handle Dart_NewList ( intptr_t  length)

Returns a List<dynamic> of the desired length.

Parameters
lengthThe length of the list.
Returns
The List object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewListOfType()

DART_EXPORT Dart_Handle Dart_NewListOfType ( Dart_Handle  element_type,
intptr_t  length 
)

Returns a List of the desired length with the desired element type.

Parameters
element_typeHandle to a nullable type object. E.g., from Dart_GetType or Dart_GetNullableType.
lengthThe length of the list.
Returns
The List object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewListOfTypeFilled()

DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled ( Dart_Handle  element_type,
Dart_Handle  fill_object,
intptr_t  length 
)

Returns a List of the desired length with the desired element type, filled with the provided object.

Parameters
element_typeHandle to a type object. E.g., from Dart_GetType.
fill_objectHandle to an object of type 'element_type' that will be used to populate the list. This parameter can only be Dart_Null() if the length of the list is 0 or 'element_type' is a nullable type.
lengthThe length of the list.
Returns
The List object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewPersistentHandle()

DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle ( Dart_Handle  object)

Allocates a persistent handle for an object.

This handle has the lifetime of the current isolate unless it is explicitly deallocated by calling Dart_DeletePersistentHandle.

Requires there to be a current isolate.

◆ Dart_NewSendPort()

DART_EXPORT Dart_Handle Dart_NewSendPort ( Dart_Port  port_id)

Returns a new SendPort with the provided port id.

If there is a possibility of a port closing since port_id was acquired for a SendPort, one should use Dart_NewSendPortEx and Dart_SendPortGetIdEx.

Parameters
port_idThe destination port.
Returns
A new SendPort if no errors occurs. Otherwise returns an error handle.

◆ Dart_NewSendPortEx()

DART_EXPORT Dart_Handle Dart_NewSendPortEx ( Dart_PortEx  portex_id)

Returns a new SendPort with the provided port id and origin id.

Parameters
portex_idThe destination composte port id.
Returns
A new SendPort if no errors occurs. Otherwise returns an error handle.

◆ Dart_NewStringFromCString()

DART_EXPORT Dart_Handle Dart_NewStringFromCString ( const char *  str)

Returns a String built from the provided C string (There is an implicit assumption that the C string passed in contains UTF-8 encoded characters and '\0' is considered as a termination character).

Parameters
strA C String
Returns
The String object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewStringFromUTF16()

DART_EXPORT Dart_Handle Dart_NewStringFromUTF16 ( const uint16_t *  utf16_array,
intptr_t  length 
)

Returns a String built from an array of UTF-16 encoded characters.

Parameters
utf16_arrayAn array of UTF-16 encoded characters.
lengthThe length of the codepoints array.
Returns
The String object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewStringFromUTF32()

DART_EXPORT Dart_Handle Dart_NewStringFromUTF32 ( const int32_t *  utf32_array,
intptr_t  length 
)

Returns a String built from an array of UTF-32 encoded characters.

Parameters
utf32_arrayAn array of UTF-32 encoded characters.
lengthThe length of the codepoints array.
Returns
The String object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewStringFromUTF8()

DART_EXPORT Dart_Handle Dart_NewStringFromUTF8 ( const uint8_t *  utf8_array,
intptr_t  length 
)

Returns a String built from an array of UTF-8 encoded characters.

Parameters
utf8_arrayAn array of UTF-8 encoded characters.
lengthThe length of the codepoints array.
Returns
The String object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewTypedData()

DART_EXPORT Dart_Handle Dart_NewTypedData ( Dart_TypedData_Type  type,
intptr_t  length 
)

Returns a TypedData object of the desired length and type.

Parameters
typeThe type of the TypedData object.
lengthThe length of the TypedData object (length in type units).
Returns
The TypedData object if no error occurs. Otherwise returns an error handle.

◆ Dart_NewUnhandledExceptionError()

DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError ( Dart_Handle  exception)

Produces a new unhandled exception error handle.

Requires there to be a current isolate.

Parameters
exceptionAn instance of a Dart object to be thrown or an ApiError or CompilationError handle. When an ApiError or CompilationError handle is passed in a string object of the error message is created and it becomes the Dart object to be thrown.

◆ Dart_NewUnmodifiableExternalTypedDataWithFinalizer()

DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer ( Dart_TypedData_Type  type,
const void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

◆ Dart_NewWeakPersistentHandle()

DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle ( Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Allocates a weak persistent handle for an object.

This handle has the lifetime of the current isolate. The handle can also be explicitly deallocated by calling Dart_DeleteWeakPersistentHandle.

If the object becomes unreachable the callback is invoked with the peer as argument. The callback can be executed on any thread, will have a current isolate group, but will not have a current isolate. The callback can only call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle. This gives the embedder the ability to cleanup data associated with the object. The handle will point to the Dart_Null object after the finalizer has been run. It is illegal to call into the VM with any other Dart_* functions from the callback. If the handle is deleted before the object becomes unreachable, the callback is never invoked.

Requires there to be a current isolate.

Parameters
objectAn object with identity.
peerA pointer to a native object or NULL. This value is provided to callback when it is invoked.
external_allocation_sizeThe number of externally allocated bytes for peer. Used to inform the garbage collector.
callbackA function pointer that will be invoked sometime after the object is garbage collected, unless the handle has been deleted. A valid callback needs to be specified it cannot be NULL.
Returns
The weak persistent handle or NULL. NULL is returned in case of bad parameters.

◆ Dart_NotifyDestroyed()

DART_EXPORT void Dart_NotifyDestroyed ( void  )

Notifies the VM that the embedder expects the application's working set has recently shrunk significantly and is not expected to rise in the near future. The VM may spend O(heap-size) time performing clean up work.

Requires there to be a current isolate.

◆ Dart_NotifyIdle()

DART_EXPORT void Dart_NotifyIdle ( int64_t  deadline)

Notifies the VM that the embedder expects to be idle until |deadline|. The VM may use this time to perform garbage collection or other tasks to avoid delays during execution of Dart code in the future.

|deadline| is measured in microseconds against the system's monotonic time. This clock can be accessed via Dart_TimelineGetMicros().

Requires there to be a current isolate.

◆ Dart_NotifyLowMemory()

DART_EXPORT void Dart_NotifyLowMemory ( void  )

Notifies the VM that the system is running low on memory.

Does not require a current isolate. Only valid after calling Dart_Initialize.

◆ Dart_Null()

DART_EXPORT Dart_Handle Dart_Null ( void  )

Returns the null object.

Returns
A handle to the null object.

◆ Dart_ObjectEquals()

DART_EXPORT Dart_Handle Dart_ObjectEquals ( Dart_Handle  obj1,
Dart_Handle  obj2,
bool *  equal 
)

Checks if the two objects are equal.

The result of the comparison is returned through the 'equal' parameter. The return value itself is used to indicate success or failure, not equality.

May generate an unhandled exception error.

Parameters
obj1An object to be compared.
obj2An object to be compared.
equalReturns the result of the equality comparison.
Returns
A valid handle if no error occurs during the comparison.

◆ Dart_ObjectIsType()

DART_EXPORT Dart_Handle Dart_ObjectIsType ( Dart_Handle  object,
Dart_Handle  type,
bool *  instanceof 
)

Is this object an instance of some type?

The result of the test is returned through the 'instanceof' parameter. The return value itself is used to indicate success or failure.

Parameters
objectAn object.
typeA type.
instanceofReturn true if 'object' is an instance of type 'type'.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_Post()

DART_EXPORT bool Dart_Post ( Dart_Port  port_id,
Dart_Handle  object 
)

Posts a message for some isolate. The message is a serialized object.

Requires there to be a current isolate.

For posting messages outside of an isolate see Dart_PostCObject.

Parameters
port_idThe destination port.
objectAn object from the current isolate.
Returns
True if the message was posted.

◆ Dart_Precompile()

DART_EXPORT Dart_Handle Dart_Precompile ( void  )

Compiles all functions reachable from entry points and marks the isolate to disallow future compilation.

Entry points should be specified using @pragma("vm:entry-point") annotation.

Returns
An error handle if a compilation error or runtime error running const constructors was encountered.

◆ Dart_PrepareToAbort()

DART_EXPORT void Dart_PrepareToAbort ( void  )

Indicate that the process is about to abort, and the Dart VM should not attempt to cleanup resources.

◆ Dart_PropagateError()

DART_EXPORT void Dart_PropagateError ( Dart_Handle  handle)

Propagates an error.

If the provided handle is an unhandled exception error, this function will cause the unhandled exception to be rethrown. This will proceed in the standard way, walking up Dart frames until an appropriate 'catch' block is found, executing 'finally' blocks, etc.

If the error is not an unhandled exception error, we will unwind the stack to the next C frame. Intervening Dart frames will be discarded; specifically, 'finally' blocks will not execute. This is the standard way that compilation errors (and the like) are handled by the Dart runtime.

In either case, when an error is propagated any current scopes created by Dart_EnterScope will be exited.

See the additional discussion under "Propagating Errors" at the beginning of this file.

Parameters
handleAn error handle (See Dart_IsError)

On success, this function does not return. On failure, the process is terminated.

◆ Dart_RegisterHeapSamplingCallback()

DART_EXPORT void Dart_RegisterHeapSamplingCallback ( Dart_HeapSamplingCreateCallback  create_callback,
Dart_HeapSamplingDeleteCallback  delete_callback 
)

◆ Dart_ReportSurvivingAllocations()

DART_EXPORT void Dart_ReportSurvivingAllocations ( Dart_HeapSamplingReportCallback  callback,
void *  context,
bool  force_gc 
)

◆ Dart_ReThrowException()

DART_EXPORT Dart_Handle Dart_ReThrowException ( Dart_Handle  exception,
Dart_Handle  stacktrace 
)

Rethrows an exception.

Rethrows an exception, unwinding all dart frames on the stack. If successful, this function does not return. Note that this means that the destructors of any stack-allocated C++ objects will not be called. If there are no Dart frames on the stack, an error occurs.

Returns
An error handle if the exception was not thrown. Otherwise the function does not return.

◆ Dart_RootLibrary()

DART_EXPORT Dart_Handle Dart_RootLibrary ( void  )

Gets the library for the root script for the current isolate.

If the root script has not yet been set for the current isolate, this function returns Dart_Null(). This function never returns an error handle.

Returns
Returns the root Library for the current isolate or Dart_Null().

◆ Dart_RunLoop()

Processes any incoming messages for the current isolate.

This function may only be used when the embedder has not provided an alternate message delivery mechanism with Dart_SetMessageCallbacks. It is provided for convenience.

This function waits for incoming messages for the current isolate. As new messages arrive, they are handled using Dart_HandleMessage. The routine exits when all ports to the current isolate are closed.

Returns
A valid handle if the run loop exited successfully. If an exception or other error occurs while processing messages, an error handle is returned.

◆ Dart_RunLoopAsync()

DART_EXPORT DART_WARN_UNUSED_RESULT bool Dart_RunLoopAsync ( bool  errors_are_fatal,
Dart_Port  on_error_port,
Dart_Port  on_exit_port,
char **  error 
)

Lets the VM run message processing for the isolate.

This function expects there to a current isolate and the current isolate must not have an active api scope. The VM will take care of making the isolate runnable (if not already), handles its message loop and will take care of shutting the isolate down once it's done.

Parameters
errors_are_fatalWhether uncaught errors should be fatal.
on_error_portA port to notify on uncaught errors (or ILLEGAL_PORT).
on_exit_portA port to notify on exit (or ILLEGAL_PORT).
errorA non-NULL pointer which will hold an error message if the call fails. The error has to be free()ed by the caller.
Returns
If successful the VM takes ownership of the isolate and takes care of its message loop. If not successful the caller retains ownership of the isolate.

◆ Dart_ScopeAllocate()

DART_EXPORT uint8_t * Dart_ScopeAllocate ( intptr_t  size)

The Dart VM uses "zone allocation" for temporary structures. Zones support very fast allocation of small chunks of memory. The chunks cannot be deallocated individually, but instead zones support deallocating all chunks in one fast operation.

This function makes it possible for the embedder to allocate temporary data in the VMs zone allocator.

Zone allocation is possible:

  1. when inside a scope where local handles can be allocated
  2. when processing a message from a native port in a native port handler

All the memory allocated this way will be reclaimed either on the next call to Dart_ExitScope or when the native port handler exits.

Parameters
sizeSize of the memory to allocate.
Returns
A pointer to the allocated memory. NULL if allocation failed. Failure might due to is no current VM zone.

◆ Dart_SendPortGetId()

DART_EXPORT Dart_Handle Dart_SendPortGetId ( Dart_Handle  port,
Dart_Port port_id 
)

Gets the SendPort id for the provided SendPort.

Parameters
portA SendPort object whose id is desired.
port_idReturns the id of the SendPort.
Returns
Success if no error occurs. Otherwise returns an error handle.

◆ Dart_SendPortGetIdEx()

DART_EXPORT Dart_Handle Dart_SendPortGetIdEx ( Dart_Handle  port,
Dart_PortEx portex_id 
)

Gets the SendPort and Origin ids for the provided SendPort.

Parameters
portA SendPort object whose id is desired.
portex_idReturns composite id of the SendPort.
Returns
Success if no error occurs. Otherwise returns an error handle.

◆ Dart_SetBooleanReturnValue()

DART_EXPORT void Dart_SetBooleanReturnValue ( Dart_NativeArguments  args,
bool  retval 
)

◆ Dart_SetDartLibrarySourcesKernel()

DART_EXPORT void Dart_SetDartLibrarySourcesKernel ( const uint8_t *  platform_kernel,
const intptr_t  platform_kernel_size 
)

Sets the kernel buffer which will be used to load Dart SDK sources dynamically at runtime.

Parameters
platform_kernelA buffer containing kernel which has sources for the Dart SDK populated. Note: The VM does not take ownership of this memory.
platform_kernel_sizeThe length of the platform_kernel buffer.

◆ Dart_SetDeferredLoadHandler()

DART_EXPORT Dart_Handle Dart_SetDeferredLoadHandler ( Dart_DeferredLoadHandler  handler)

Sets the deferred load handler for the current isolate. This handler is used to handle loading deferred imports in an AppJIT or AppAOT program.

◆ Dart_SetDoubleReturnValue()

DART_EXPORT void Dart_SetDoubleReturnValue ( Dart_NativeArguments  args,
double  retval 
)

◆ Dart_SetDwarfStackTraceFootnoteCallback()

DART_EXPORT void Dart_SetDwarfStackTraceFootnoteCallback ( Dart_DwarfStackTraceFootnoteCallback  callback)

Configure DWARF stack trace footnote callback.

◆ Dart_SetEnvironmentCallback()

DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback ( Dart_EnvironmentCallback  callback)

Sets the environment callback for the current isolate. This callback is used to lookup environment values by name in the current environment. This enables the embedder to supply values for the const constructors bool.fromEnvironment, int.fromEnvironment and String.fromEnvironment.

◆ Dart_SetFfiNativeResolver()

DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver ( Dart_Handle  library,
Dart_FfiNativeResolver  resolver 
)

Sets the callback used to resolve FFI native functions for a library. The resolved functions are expected to be a C function pointer of the correct signature (as specified in the @Native<NFT>() function annotation in Dart code).

NOTE: This is an experimental feature and might change in the future.

Parameters
libraryA library.
resolverA native function resolver.
Returns
A valid handle if the native resolver was set successfully.

◆ Dart_SetField()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SetField ( Dart_Handle  container,
Dart_Handle  name,
Dart_Handle  value 
)

Sets the value of a field.

The 'container' parameter may actually be an object, type, or library. If 'container' is an object, then this function will access an instance field. If 'container' is a type, then this function will access a static field. If 'container' is a library, then this function will access a top-level variable. NOTE: This API call cannot be used to access fields of a type object.

This function ignores field visibility (leading underscores in names).

May generate an unhandled exception error.

Parameters
containerAn object, type, or library.
nameA field name.
valueThe new field value.
Returns
A valid handle if no error occurs.

◆ Dart_SetHeapSamplingPeriod()

DART_EXPORT void Dart_SetHeapSamplingPeriod ( intptr_t  bytes)

◆ Dart_SetIntegerReturnValue()

DART_EXPORT void Dart_SetIntegerReturnValue ( Dart_NativeArguments  args,
int64_t  retval 
)

◆ Dart_SetLibraryTagHandler()

DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler ( Dart_LibraryTagHandler  handler)

Sets library tag handler for the current isolate. This handler is used to handle the various tags encountered while loading libraries or scripts in the isolate.

Parameters
handlerHandler code to be used for handling the various tags encountered while loading libraries or scripts in the isolate.
Returns
If no error occurs, the handler is set for the isolate. Otherwise an error handle is returned.

TODO(turnidge): Document.

◆ Dart_SetMessageNotifyCallback()

DART_EXPORT void Dart_SetMessageNotifyCallback ( Dart_MessageNotifyCallback  message_notify_callback)

Allows embedders to provide a custom wakeup mechanism for the delivery of inter-isolate messages. This setting only applies to the current isolate.

This mechanism is optional: if not provided, the isolate will be scheduled on a VM-managed thread pool. An embedder should provide this callback if it wants to run an isolate on a specific thread or to interleave handling of inter-isolate messages with other event sources.

Most embedders will only call this function once, before isolate execution begins. If this function is called after isolate execution begins, the embedder is responsible for threading issues.

◆ Dart_SetNativeInstanceField()

DART_EXPORT Dart_Handle Dart_SetNativeInstanceField ( Dart_Handle  obj,
int  index,
intptr_t  value 
)

Sets the value of a native field.

TODO(turnidge): Document.

◆ Dart_SetNativeResolver()

DART_EXPORT Dart_Handle Dart_SetNativeResolver ( Dart_Handle  library,
Dart_NativeEntryResolver  resolver,
Dart_NativeEntrySymbol  symbol 
)

Sets the callback used to resolve native functions for a library.

Parameters
libraryA library.
resolverA native entry resolver.
Returns
A valid handle if the native resolver was set successfully.

◆ Dart_SetPausedOnExit()

DART_EXPORT void Dart_SetPausedOnExit ( bool  paused)

Called when the embedder has paused the current isolate on exit and when the embedder has resumed the isolate.

Parameters
pausedIs the isolate paused on exit?

◆ Dart_SetPausedOnStart()

DART_EXPORT void Dart_SetPausedOnStart ( bool  paused)

Called when the embedder has paused the current isolate on start and when the embedder has resumed the isolate.

Parameters
pausedIs the isolate paused on start?

◆ Dart_SetPeer()

DART_EXPORT Dart_Handle Dart_SetPeer ( Dart_Handle  object,
void *  peer 
)

Sets the value of the peer field of 'object' to the value of 'peer'.

Parameters
objectAn object.
peerA value to store in the peer field.
Returns
Returns an error if 'object' is a subtype of Null, num, or bool.

◆ Dart_SetPerformanceMode()

DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode ( Dart_PerformanceMode  mode)

Set the desired performance trade-off.

Requires a current isolate.

Returns the previous performance mode.

◆ Dart_SetPersistentHandle()

DART_EXPORT void Dart_SetPersistentHandle ( Dart_PersistentHandle  obj1,
Dart_Handle  obj2 
)

Assign value of local handle to a persistent handle.

Requires there to be a current isolate.

Parameters
obj1A persistent handle whose value needs to be set.
obj2An object whose value needs to be set to the persistent handle.

◆ Dart_SetReturnValue()

DART_EXPORT void Dart_SetReturnValue ( Dart_NativeArguments  args,
Dart_Handle  retval 
)

Sets the return value for a native function.

If retval is an Error handle, then error will be propagated once the native functions exits. See Dart_PropagateError for a discussion of how different types of errors are propagated.

◆ Dart_SetRootLibrary()

DART_EXPORT Dart_Handle Dart_SetRootLibrary ( Dart_Handle  library)

Sets the root library for the current isolate.

Returns
Returns an error handle if library is not a library handle.

◆ Dart_SetShouldPauseOnExit()

DART_EXPORT void Dart_SetShouldPauseOnExit ( bool  should_pause)

Override the VM flag --pause-isolates-on-exit for the current isolate.

Parameters
should_pauseShould the isolate be paused on exit?

◆ Dart_SetShouldPauseOnStart()

DART_EXPORT void Dart_SetShouldPauseOnStart ( bool  should_pause)

Override the VM flag --pause-isolates-on-start for the current isolate.

Parameters
should_pauseShould the isolate be paused on start?

NOTE: This must be called before Dart_IsolateMakeRunnable.

◆ Dart_SetStickyError()

DART_EXPORT void Dart_SetStickyError ( Dart_Handle  error)

Called when the embedder has caught a top level unhandled exception error in the current isolate.

NOTE: It is illegal to call this twice on the same isolate without first clearing the sticky error to null.

Parameters
errorThe unhandled exception error.

◆ Dart_SetVMFlags()

DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_SetVMFlags ( int  argc,
const char **  argv 
)

Sets command line flags. Should be called before Dart_Initialize.

Parameters
argcThe length of the arguments array.
argvAn array of arguments.
Returns
NULL if successful. Returns an error message otherwise. The caller is responsible for freeing the error message.

NOTE: This call does not store references to the passed in c-strings.

◆ Dart_SetWeakHandleReturnValue()

DART_EXPORT void Dart_SetWeakHandleReturnValue ( Dart_NativeArguments  args,
Dart_WeakPersistentHandle  rval 
)

◆ Dart_ShouldPauseOnExit()

DART_EXPORT bool Dart_ShouldPauseOnExit ( void  )

If the VM flag --pause-isolates-on-exit was passed this will be true.

Returns
A boolean value indicating if pause on exit was requested.

◆ Dart_ShouldPauseOnStart()

DART_EXPORT bool Dart_ShouldPauseOnStart ( void  )

The VM's default message handler supports pausing an isolate before it processes the first message and right after the it processes the isolate's final message. This can be controlled for all isolates by two VM flags:

--pause-isolates-on-start --pause-isolates-on-exit

Additionally, Dart_SetShouldPauseOnStart and Dart_SetShouldPauseOnExit can be used to control this behaviour on a per-isolate basis.

When an embedder is using a Dart_MessageNotifyCallback the embedder needs to cooperate with the VM so that the service protocol can report accurate information about isolates and so that tools such as debuggers work reliably.

The following functions can be used to implement pausing on start and exit. If the VM flag --pause-isolates-on-start was passed this will be true.

Returns
A boolean value indicating if pause on start was requested.

◆ Dart_ShutdownIsolate()

DART_EXPORT void Dart_ShutdownIsolate ( void  )

Shuts down the current isolate. After this call, the current isolate is NULL. Any current scopes created by Dart_EnterScope will be exited. Invokes the shutdown callback and any callbacks of remaining weak persistent handles.

Requires there to be a current isolate.

◆ Dart_SortClasses()

DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SortClasses ( void  )

Sorts the class-ids in depth first traversal order of the inheritance tree. This is a costly operation, but it can make method dispatch more efficient and is done before writing snapshots.

Returns
A valid handle if no error occurs during the operation.

◆ Dart_StartProfiling()

DART_EXPORT void Dart_StartProfiling ( void  )

Starts the CPU sampling profiler.

◆ Dart_StopProfiling()

DART_EXPORT void Dart_StopProfiling ( void  )

Stops the CPU sampling profiler.

Note that some profile samples might still be taken after this function returns due to the asynchronous nature of the implementation on some platforms.

◆ Dart_StringGetProperties()

DART_EXPORT Dart_Handle Dart_StringGetProperties ( Dart_Handle  str,
intptr_t *  char_size,
intptr_t *  str_len,
void **  peer 
)

Retrieves some properties associated with a String. Properties retrieved are:

  • character size of the string (one or two byte)
  • length of the string
  • peer pointer of string if it is an external string.
    Parameters
    strA String.
    char_sizeReturns the character size of the String.
    str_lenReturns the length of the String.
    peerReturns the peer pointer associated with the String or 0 if there is no peer pointer for it.
    Returns
    Success if no error occurs. Otherwise returns an error handle.

◆ Dart_StringLength()

DART_EXPORT Dart_Handle Dart_StringLength ( Dart_Handle  str,
intptr_t *  length 
)

Gets the length of a String.

Parameters
strA String.
lengthReturns the length of the String.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringStorageSize()

DART_EXPORT Dart_Handle Dart_StringStorageSize ( Dart_Handle  str,
intptr_t *  size 
)

Gets the storage size in bytes of a String.

Parameters
strA String.
sizeReturns the storage size in bytes of the String. This is the size in bytes needed to store the String.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringToCString()

DART_EXPORT Dart_Handle Dart_StringToCString ( Dart_Handle  str,
const char **  cstr 
)

Gets the C string representation of a String. (It is a sequence of UTF-8 encoded values with a '\0' termination.)

Parameters
strA string.
cstrReturns the String represented as a C string. This C string is scope allocated and is only valid until the next call to Dart_ExitScope.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringToLatin1()

DART_EXPORT Dart_Handle Dart_StringToLatin1 ( Dart_Handle  str,
uint8_t *  latin1_array,
intptr_t *  length 
)

Gets the data corresponding to the string object. This function returns the data only for Latin-1 (ISO-8859-1) string objects. For all other string objects it returns an error.

Parameters
strA string.
latin1_arrayAn array allocated by the caller, used to return the string data.
lengthUsed to pass in the length of the provided array. Used to return the length of the array which was actually used.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringToUTF16()

DART_EXPORT Dart_Handle Dart_StringToUTF16 ( Dart_Handle  str,
uint16_t *  utf16_array,
intptr_t *  length 
)

Gets the UTF-16 encoded representation of a string.

Parameters
strA string.
utf16_arrayAn array allocated by the caller, used to return the array of UTF-16 encoded characters.
lengthUsed to pass in the length of the provided array. Used to return the length of the array which was actually used.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringToUTF8()

DART_EXPORT Dart_Handle Dart_StringToUTF8 ( Dart_Handle  str,
uint8_t **  utf8_array,
intptr_t *  length 
)

Gets a UTF-8 encoded representation of a String.

Any unpaired surrogate code points in the string will be converted as replacement characters (U+FFFD, 0xEF 0xBF 0xBD in UTF-8). If you need to preserve unpaired surrogates, use the Dart_StringToUTF16 function.

Parameters
strA string.
utf8_arrayReturns the String represented as UTF-8 code units. This UTF-8 array is scope allocated and is only valid until the next call to Dart_ExitScope.
lengthUsed to return the length of the array which was actually used.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_StringUTF8Length()

DART_EXPORT Dart_Handle Dart_StringUTF8Length ( Dart_Handle  str,
intptr_t *  length 
)

Gets the length of UTF-8 encoded representation for a string.

Parameters
strA String.
lengthReturns the length of UTF-8 encoded representation for string.
Returns
A valid handle if no error occurs during the operation.

◆ Dart_ThreadDisableProfiling()

DART_EXPORT void Dart_ThreadDisableProfiling ( void  )

Notifies the VM that the current thread should not be profiled until a matching call to Dart_ThreadEnableProfiling is made.

NOTE: By default, if a thread has entered an isolate it will be profiled. This function should be used when an embedder knows a thread is about to make a blocking call and wants to avoid unnecessary interrupts by the profiler.

◆ Dart_ThreadEnableProfiling()

DART_EXPORT void Dart_ThreadEnableProfiling ( void  )

Notifies the VM that the current thread should be profiled.

NOTE: It is only legal to call this function after calling Dart_ThreadDisableProfiling.

NOTE: By default, if a thread has entered an isolate it will be profiled.

◆ Dart_ThrowException()

DART_EXPORT Dart_Handle Dart_ThrowException ( Dart_Handle  exception)

Throws an exception.

This function causes a Dart language exception to be thrown. This will proceed in the standard way, walking up Dart frames until an appropriate 'catch' block is found, executing 'finally' blocks, etc.

If an error handle is passed into this function, the error is propagated immediately. See Dart_PropagateError for a discussion of error propagation.

If successful, this function does not return. Note that this means that the destructors of any stack-allocated C++ objects will not be called. If there are no Dart frames on the stack, an error occurs.

Returns
An error handle if the exception was not thrown. Otherwise the function does not return.

◆ Dart_ToString()

DART_EXPORT Dart_Handle Dart_ToString ( Dart_Handle  object)

Converts an object to a string.

May generate an unhandled exception error.

Returns
The converted string if no error occurs during the conversion. If an error does occur, an error handle is returned.

◆ Dart_True()

DART_EXPORT Dart_Handle Dart_True ( void  )

Returns the True object.

Requires there to be a current isolate.

Returns
A handle to the True object.

◆ Dart_TypedDataAcquireData()

DART_EXPORT Dart_Handle Dart_TypedDataAcquireData ( Dart_Handle  object,
Dart_TypedData_Type type,
void **  data,
intptr_t *  len 
)

Acquires access to the internal data address of a TypedData object.

Parameters
objectThe typed data object whose internal data address is to be accessed.
typeThe type of the object is returned here.
dataThe internal data address is returned here.
lenSize of the typed array is returned here.

Notes: When the internal address of the object is acquired any calls to a Dart API function that could potentially allocate an object or run any Dart code will return an error.

Any Dart API functions for accessing the data should not be called before the corresponding release. In particular, the object should not be acquired again before its release. This leads to undefined behavior.

Returns
Success if the internal data address is acquired successfully. Otherwise, returns an error handle.

◆ Dart_TypedDataReleaseData()

DART_EXPORT Dart_Handle Dart_TypedDataReleaseData ( Dart_Handle  object)

Releases access to the internal data address that was acquired earlier using Dart_TypedDataAcquireData.

Parameters
objectThe typed data object whose internal data address is to be released.
Returns
Success if the internal data address is released successfully. Otherwise, returns an error handle.

◆ Dart_TypeDynamic()

DART_EXPORT Dart_Handle Dart_TypeDynamic ( void  )

Returns types that are not classes, and which therefore cannot be looked up as library members by Dart_GetType.

Returns
A handle to the dynamic, void or Never type.

◆ Dart_TypeNever()

DART_EXPORT Dart_Handle Dart_TypeNever ( void  )

◆ Dart_TypeToNonNullableType()

DART_EXPORT Dart_Handle Dart_TypeToNonNullableType ( Dart_Handle  type)

Creates a non-nullable version of the provided type.

Parameters
typeThe type to be converted to a non-nullable type.
Returns
If no error occurs, a non-nullable type is returned. Otherwise an error handle is returned.

◆ Dart_TypeToNullableType()

DART_EXPORT Dart_Handle Dart_TypeToNullableType ( Dart_Handle  type)

Creates a nullable version of the provided type.

Parameters
typeThe type to be converted to a nullable type.
Returns
If no error occurs, a nullable type is returned. Otherwise an error handle is returned.

◆ Dart_TypeVoid()

DART_EXPORT Dart_Handle Dart_TypeVoid ( void  )

◆ Dart_VersionString()

DART_EXPORT const char * Dart_VersionString ( void  )

Gets the version string for the Dart VM.

The version of the Dart VM can be accessed without initializing the VM.

Returns
The version string for the embedded Dart VM.

◆ Dart_WriteProfileToTimeline()

DART_EXPORT bool Dart_WriteProfileToTimeline ( Dart_Port  main_port,
char **  error 
)

Writes the CPU profile to the timeline as a series of 'instant' events.

Note that this is an expensive operation.

Parameters
main_portThe main port of the Isolate whose profile samples to write.
errorAn optional error, must be free()ed by caller.
Returns
Returns true if the profile is successfully written and false otherwise.