Expand description
Opt-in style bindings to the Dart SDK
This crate provides bindings to the Dart SDK. It is generated using bindgen and the official Dart SDK.
Bindings are generated statically, meaning that the Dart SDK headers are included in the crate and no external dependencies are required.
Structs§
- A Dart_CObject is used for representing Dart objects as native C data outside the Dart heap. These objects are totally detached from the Dart heap. Only a subset of the Dart objects have a representation as a Dart_CObject.
- Forward declaration
- Describes how to initialize the VM. Used with Dart_Initialize.
- Experimental support for Dart to Kernel parser isolate.
Constants§
- Balanced
- 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.
- Optimize for low memory, at the expensive of throughput and latency by more frequently performing work.
- Optimize for high throughput, at the expense of latency and memory overhead by performing work in larger batches with more intervening growth.
Statics§
Functions§
- Register symbol information for the Dart VM’s profiler and crash dumps.
- Allocate a new object without invoking a constructor.
- Allocate a new object without invoking a constructor, and sets specified native fields.
- Gets the value of a Boolean
- Returns a handle to the library which contains class.
- Returns the name for the provided class type.
- Cleanup state in the VM before process termination.
- Closes the native port with the given id.
- Retrieves the function of a closure.
- Forces all loaded classes and functions to be compiled eagerly in the current isolate..
- Compiles the given
script_uri
to a kernel file. - Creates a precompiled snapshot.
- Creates a precompiled snapshot.
- Creates a snapshot that caches compiled code and type feedback for faster startup and quicker warmup in a subsequent process.
- Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot.
- Creates a new isolate. The new isolate becomes the current isolate.
- Creates a new isolate from a Dart Kernel file. The new isolate becomes the current isolate.
- Creates a new isolate inside the isolate group of [group_member].
- Creates a full snapshot of the current isolate heap.
- 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.
- Returns the current isolate. Will return NULL if there is no current isolate.
- Returns the callback data associated with the current isolate. This data was set when the isolate got created or initialized.
- Returns the current isolate group. Will return NULL if there is no current isolate group.
- Returns the callback data associated with the current isolate group. This data was passed to the isolate group when it was created.
- Returns the debugging name for the current isolate.
- Returns the debugging name for the current isolate.
- Canonicalizes a url with respect to some library.
- Notifies the VM that a deferred load completed successfully. This function will eventually cause the corresponding
prefix.loadLibrary()
futures to complete. - Notifies the VM that a deferred load failed. This function will eventually cause the corresponding
prefix.loadLibrary()
futures to complete with an error. - Deletes the given finalizable [object] handle.
- Deallocates a persistent handle.
- Deletes the given weak persistent [object] handle.
- Detect the null safety opt-in status.
- Gets the value of a Double
- Print a native stack trace. Used for crash handling.
- Returns the empty string object.
- Starts the heap sampling profiler for each thread in the VM.
- Enters an isolate. After calling this function, the current isolate will be set to the provided isolate.
- Enters a new scope.
- Gets the exception Object from an unhandled exception error handle.
- Gets the stack trace Object from an unhandled exception error handle.
- Is this an error handle for an unhandled exception?
- Exits an isolate. After this call, Dart_CurrentIsolate will return NULL.
- Exits a scope.
- Returns the False object.
- Finalizes all classes.
- Indicates that all outstanding load requests have been satisfied. This finalizes all the new classes loaded and optionally completes deferred library futures.
- Determines whether a function handle refers to a static function of method.
- Returns the name for the provided function or method.
- Returns a handle to the owner of a function.
- Lookup a class or interface by name from a Library.
- Returns the TypedData object associated with the ByteBuffer object.
- Gets the error message from an error handle.
- Gets the value of a field.
- \return An array of libraries.
- Gets the main port id for the current isolate.
- Query the current message notify callback for the isolate.
- Gets the native argument at some index.
- Gets the number of native arguments.
- Gets the native arguments based on the types passed in and populates the passed arguments buffer with appropriate native values.
- Gets a boolean native argument at some index. \param args Native arguments structure. \param index Index of the desired argument in the structure above. \param value Returns the boolean value if the argument is a Boolean. \return Success if no error occurs. Otherwise returns an error handle.
- Gets a double native argument at some index. \param args Native arguments structure. \param index Index of the desired argument in the structure above. \param value Returns the double value if the argument is a double. \return Success if no error occurs. Otherwise returns an error handle.
- Gets all the native fields of the native argument at some index. \param args Native arguments structure. \param arg_index Index of the desired argument in the structure above. \param num_fields size of the intptr_t array ‘field_values’ passed in. \param field_values intptr_t array in which native field values are returned. \return 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.
- Gets the value of a native field.
- Gets the number of native instance fields in an object.
- Gets an integer native argument at some index. \param args Native arguments structure. \param index Index of the desired argument in the structure above. \param value Returns the integer value if the argument is an Integer. \return Success if no error occurs. Otherwise returns an error handle.
- Extracts current isolate group data from the native arguments structure.
- Gets the native field of the receiver.
- Returns the callback used to resolve native functions for a library.
- Gets a string native argument at some index. \param args Native arguments structure. \param arg_index Index of the desired argument in the structure above. \param peer Returns the peer pointer if the string argument has one. \return 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).
- Returns the callback used to resolve native function symbols for a library.
- Lookup or instantiate a non-nullable type by name and type arguments from Library.
- Lookup or instantiate a nullable type by name and type arguments from Library.
- Get obfuscation map for precompiled code.
- Returns the value of peer field of ‘object’ in ‘peer’.
- Returns a closure of static function ‘function_name’ in the class ‘class_name’ in the exported namespace of specified ‘library’.
- Gets the sticky error for the current isolate.
- Lookup or instantiate a legacy type by name and type arguments from a Library.
- Return type if this object is an external TypedData object.
- Return type if this object is a TypedData object.
- Allocates a handle in the current scope from a persistent handle.
- Allocates a handle in the current scope from a weak persistent handle.
- Handles the next pending message for the current isolate.
- Handles any pending messages for the vm service for the current isolate.
- Does the current isolate have live ReceivePorts?
- Does the current isolate have pending service messages?
- Does the current isolate have a sticky error?
- Checks to see if two handles refer to identically equal objects.
- Initializes the VM.
- \mainpage Dynamically Linked Dart API
- Gets the type of a Dart language object.
- Does this Integer fit into a 64-bit signed integer?
- Does this Integer fit into a 64-bit unsigned integer?
- Gets the value of an integer as a hexadecimal C string.
- Gets the value of an Integer.
- Gets the value of an Integer.
- Invokes a method or function.
- Invokes a Closure with the given arguments.
- Invokes a Generative Constructor on an object that was previously allocated using Dart_Allocate/Dart_AllocateWithNativeFields.
- Invoke a vm-service method and wait for its result.
- Is this an api error handle?
- Is this a compilation error handle?
- Is this an error handle?
- Is this a fatal error handle?
- Query object type.
- Returns whether the buffer contains a kernel file.
- Is this object null?
- A type’s nullability.
- Is the current isolate paused on exit?
- Is the current isolate paused on start?
- 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).
- Returns true if isolate is currently reloading.
- Returns true if isolate is the service isolate.
- Is this object a closure resulting from a tear-off (closurized method)?
- Is this an unhandled exception error handle?
- Returns true if the named VM flag is of boolean type, specified, and set to true.
- Returns the callback data associated with the given isolate. This data was set when the isolate got created or initialized.
- Initialize Dart_IsolateFlags with correct version and default values.
- 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.
- Return metrics gathered for the VM and individual isolates.
- Make isolate runnable.
- Returns the ID for an isolate which is used to query the service protocol.
- Kills the given isolate.
- Report an loading error for the library.
- Returns a URL from which a Library was loaded.
- Returns an import path to a Library, such as “file:///test.dart” or “dart:core”.
- May generate an unhandled exception error.
- Gets the Object at some index of a List.
- Gets a range of Objects from a List.
- Gets the length of a List.
- May generate an unhandled exception error.
- Sets the Object at some index of a List.
- Called by the embedder to load a partial program. Does not set the root library.
- Loads the root library for the current isolate.
- Returns whether the Map contains a given key.
- Gets the Object at some key of a Map.
- Gets the list of keys of a Map.
- Invokes a constructor, creating a new object.
- Produces an api error handle with the provided error message.
- Returns a Boolean with the provided value.
- Returns a ByteBuffer object for the typed data.
- Returns a Double with the provided value.
- Returns a String which references an external array of Latin-1 (ISO-8859-1) encoded characters.
- Returns a TypedData object which references an external data array.
- Returns a TypedData object which references an external data array.
- Returns a String which references an external array of UTF-16 encoded characters.
- Allocates a finalizable handle for an object.
- Returns an Integer with the provided value.
- Returns an Integer with the provided value.
- Returns an Integer with the provided value.
- Returns a List
of the desired length. - Returns a List of the desired length with the desired legacy element type.
- Returns a List of the desired length with the desired element type.
- Returns a List of the desired length with the desired element type, filled with the provided object.
- Creates a new native port. When messages are received on this native port, then they will be dispatched to the provided native message handler.
- Allocates a persistent handle for an object.
- Returns a new SendPort with the provided port id.
- 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).
- Returns a String built from an array of UTF-8 encoded characters.
- Returns a String built from an array of UTF-16 encoded characters.
- Returns a String built from an array of UTF-32 encoded characters.
- Returns a TypedData object of the desired length and type.
- Produces a new unhandled exception error handle.
- Allocates a weak persistent handle for an object.
- 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.
- 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.
- Notifies the VM that the system is running low on memory.
- Returns the null object.
- Checks if the two objects are equal.
- Is this object an instance of some type?
- Posts a message for some isolate. The message is a serialized object.
- Posts a message on some port. The message will contain the Dart_CObject object graph rooted in ‘message’.
- Posts a message on some port. The message will contain the integer ‘message’.
- Compiles all functions reachable from entry points and marks the isolate to disallow future compilation.
- Indicate that the process is about to abort, and the Dart VM should not attempt to cleanup resources.
- Propagates an error.
- Rethrows an exception.
- Add a timeline event to the embedder stream.
- Register a Dart_ServiceRequestCallback to be called to handle requests for the named rpc on a specific isolate. The callback will be invoked with the current isolate set to the request target.
- Register a Dart_ServiceRequestCallback to be called to handle requests for the named rpc. The callback will be invoked without a current isolate.
- Gets the library for the root script for the current isolate.
- Processes any incoming messages for the current isolate.
- Lets the VM run message processing for the isolate.
- 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.
- Gets the SendPort id for the provided SendPort. \param port A SendPort object whose id is desired. \param port_id Returns the id of the SendPort. \return Success if no error occurs. Otherwise returns an error handle.
- Sends a data event to clients of the VM Service.
- Sets the kernel buffer which will be used to load Dart SDK sources dynamically at runtime.
- Sets the deferred load handler for the current isolate. This handler is used to handle loading deferred imports in an AppJIT or AppAOT program.
- Configure DWARF stack trace footnote callback.
- Register a Dart_ServiceRequestCallback to be called to handle requests for the named rpc. The callback will be invoked without a current isolate.
- Enable tracking of specified timeline category. This is operational only when systrace timeline functionality is turned on.
- 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.
- 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
@FfiNative<NFT>()
function annotation in Dart code). - Sets the value of a field.
- 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.
- Allows embedders to provide a custom wakeup mechanism for the delivery of inter-isolate messages. This setting only applies to the current isolate.
- Sets the value of a native field.
- Sets the callback used to resolve native functions for a library.
- Called when the embedder has paused the current isolate on exit and when the embedder has resumed the isolate.
- Called when the embedder has paused the current isolate on start and when the embedder has resumed the isolate.
- Sets the value of the peer field of ‘object’ to the value of ‘peer’.
- Set the desired performance trade-off.
- Assign value of local handle to a persistent handle.
- Sets the return value for a native function.
- Sets the root library for the current isolate.
- Adds VM service stream callbacks.
- Override the VM flag
--pause-isolates-on-exit
for the current isolate. - Override the VM flag
--pause-isolates-on-start
for the current isolate. - Called when the embedder has caught a top level unhandled exception error in the current isolate.
- Associates a name with the current thread. This name will be used to name threads in the timeline. Can only be called after a call to Dart_Initialize.
- Register a
Dart_TimelineRecorderCallback
to be called as timeline events are completed. - Sets command line flags. Should be called before Dart_Initialize.
- If the VM flag
--pause-isolates-on-exit
was passed this will be true. - If the VM flag
--pause-isolates-on-start
was passed this will be true. - 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.
- 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.
- Starts the CPU sampling profiler.
- Stops the CPU sampling profiler.
- Retrieves some properties associated with a String. Properties retrieved are:
- Gets the length of a String.
- Gets the storage size in bytes of a String.
- Gets the C string representation of a String. (It is a sequence of UTF-8 encoded values with a ‘\0’ termination.)
- 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.
- Gets a UTF-8 encoded representation of a String.
- Gets the UTF-16 encoded representation of a string.
- Notifies the VM that the current thread should not be profiled until a matching call to Dart_ThreadEnableProfiling is made.
- Notifies the VM that the current thread should be profiled.
- Throws an exception.
- Add a timeline event to the embedder stream.
- Returns a timestamp in microseconds. This timestamp is suitable for passing into the timeline system, and uses the same monotonic clock as dart:developer’s Timeline.now.
- Returns a raw timestamp in from the monotonic clock.
- Returns the frequency of the monotonic clock.
- Converts an object to a string.
- Returns the True object.
- Returns types that are not classes, and which therefore cannot be looked up as library members by Dart_GetType.
- Creates a non-nullable version of the provided type.
- Creates a nullable version of the provided type.
- Acquires access to the internal data address of a TypedData object.
- Releases access to the internal data address that was acquired earlier using Dart_TypedDataAcquireData.
- Gets the version string for the Dart VM.
- Drains the microtask queue, then blocks the calling thread until the current isolate receives a message, then handles all messages.
- Generate heap snapshot of the current isolate group and stream it into the given
callback
. VM would produce snapshot in chunks and send these chunks one by one back to the embedder by invoking the providedcallback
. - Writes the CPU profile to the timeline as a series of ‘instant’ events.
Type Aliases§
- 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.
- Callback provided by the embedder that is used by the VM to produce footnotes appended to DWARF stack traces.
- Callback provided by the embedder that is used by the VM to request information.
- An environment lookup callback function.
- FFI Native C function pointer resolver callback.
- Closes the opened file.
- A callback which determines whether the file at some url has been modified since some time. If the file cannot be found, true should be returned.
- Opens a file for reading or writing.
- Read contents of file.
- Write data into file.
- 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.
- An object reference managed by the Dart VM garbage collector.
- Callback provided by the caller of
Dart_WriteHeapSnapshot
which is used to write out chunks of the requested heap snapshot. - An isolate initialization callback function.
- 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.
- An isolate cleanup callback function.
- An isolate group cleanup callback function.
- An isolate creation and initialization callback function.
- Gets an id that uniquely identifies current isolate group.
- An isolate shutdown callback function.
- 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.
- A message notification callback.
- The arguments to a native function.
- Native entry resolution callback.
- Native entry symbol lookup callback.
- A native function.
- A native message handler.
- 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.
- A port is used to send or receive inter-isolate messages
- 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.
- A service request callback function.
- A callback invoked when the VM service gets a request to cancel some stream.
- A callback invoked when the VM service gets a request to listen to some stream.
- 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.
- 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.
- Callback provided by the embedder to handle the completion of timeline events.
- 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.