Skip to content

registerExtension

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

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

NOTE: method must begin with 'ext.' and you should use the following structure to avoid conflicts with other packages: 'ext.package.command'. That is, immediately following the 'ext.' prefix, should be the registering package name followed by another period ('.') and then the command name. For example: 'ext.dart.io.getOpenFiles'.

Because service extensions are isolate specific, clients using extensions must always include an 'isolateId' parameter with each RPC.