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.

To use this library in your code:

import 'dart:developer';

Typedefs

ServiceExtensionHandler(String method, Map<String, String> parameters) Future<ServiceExtensionResponse>

A service protocol extension handler. Registered with registerExtension.

TimelineAsyncFunction() Future

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.

postEvent(String eventKind, Map eventData) → void

Post an event of eventKind with payload of eventData to the Extension event stream.

registerExtension(String method, ServiceExtensionHandler handler) → void

Register a ServiceExtensionHandler that will be invoked in this isolate for method. NOTE: Service protocol extensions must be registered in each isolate.

Classes

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

A response to a service protocol extension RPC.

Timeline

Add to the timeline.

TimelineTask

An asynchronous task on the timeline. An asynchronous task can have many (nested) synchronous operations. Synchronous operations can live longer than the current isolate event. To pass a TimelineTask to another isolate, you must first call pass to get the task id and then construct a new TimelineTask in the other isolate.

UserTag

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