registerServiceExtension method

  1. @protected
void registerServiceExtension ({@required String name, @required ServiceExtensionCallback callback })
@protected

Registers a service extension method with the given name (full name "ext.flutter.inspector.name").

The given callback is called when the extension method is called. The callback must return a value that can be converted to JSON using json.encode() (see JsonEncoder). The return value is stored as a property named result in the JSON. In case of failure, the failure is reported to the remote caller and is dumped to the logs.

Implementation

@protected
void registerServiceExtension({
  @required String name,
  @required ServiceExtensionCallback callback,
}) {
  _registerServiceExtensionCallback(
    name: 'inspector.$name',
    callback: callback,
  );
}