Interact with developer tools such as the debugger and inspector.

The dart:developer library is unstable and its API might change slightly as a result of developer feedback. This library is platform dependent and therefore it has implementations for both dart2js and the Dart VM. Both are under development and may not support all operations yet.

Typedefs

ServiceExtensionHandler(String method, parameters) Future<ServiceExtensionResponse>

A service protocol extension handler. Registered with registerExtension.

TimelineSyncFunction() → dynamic

Functions

debugger({bool when: true, String message}) bool

If when is true, stop the program as if a breakpoint were hit at the following statement.

getCurrentTag() UserTag

Returns the current UserTag for the isolate.

inspect(Object object) Object

Send a reference to object to any attached debuggers.

log(String message, {DateTime time, int sequenceNumber, int level: 0, String name: '', Zone zone, Object error, StackTrace stackTrace}) → void

Emit a log event. message is the log message. time (optional) is the timestamp. sequenceNumber (optional) is a monotonically increasing sequence number. level (optional) is the severity level (value between 0 and 2000). name (optional) is the name of the source of the log message. zone (optional) the zone where the log was emitted error (optional) an error object associated with this log event. stackTrace (optional) a stack trace associated with this log event.

registerExtension(String method, Future<ServiceExtensionResponse> handler(String method, parameters)) → void

Register a ServiceExtensionHandler that will be invoked in this isolate for method.

Classes

AsyncBlock

An asynchronous block of time on the timeline. This block can be kept open across isolate messages.

Counter

A changing value. Initial value is 0.0.

Gauge

A measured value with a min and max. Initial value is min. Value will be clamped to the interval min, max.

Metric

Abstract Metric class. Metric names must be unique, are hierarchical, and use periods as separators. For example, 'a.b.c'. Uniqueness is only enforced when a Metric is registered. The name of a metric cannot contain the slash ('/') character.

Metrics

ServiceExtensionResponse

Timeline

Add to the timeline.

TimelineTask

An asynchronous task on the timeline. Asynchronous tasks can live longer than the current event and can even be shared between isolates. An asynchronous task can have many (nested) blocks. To share a TimelineTask across isolates, you must construct a TimelineTask in both isolates using the same taskId and category.

UserTag

A UserTag can be used to group samples in the Observatory profiler.