# registerExtension function

void registerExtension (String method, ServiceExtensionHandler 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.

## Implementation

    void registerExtension(String method, ServiceExtensionHandler handler) {
      ArgumentError.checkNotNull(method, 'method');
      if (!method.startsWith('ext.')) {
        throw new ArgumentError.value(method, 'method', 'Must begin with ext.');
      }
      if (_lookupExtension(method) != null) {
        throw new ArgumentError('Extension already registered: $method');
      }
      ArgumentError.checkNotNull(handler, 'handler');
      _registerExtension(method, handler);
    }