1. override
void initServiceExtensions()

Called when the binding is initialized, to register service extensions.

Bindings that want to expose service extensions should overload this method to register them using calls to registerSignalServiceExtension, registerBoolServiceExtension, registerNumericServiceExtension, and registerServiceExtension (in increasing order of complexity).

Implementations of this method must call their superclass implementation.

Service extensions are only exposed when the observatory is included in the build, which should only happen in checked mode and in profile mode.

See also:

Source

@override
void initServiceExtensions() {
  super.initServiceExtensions();
  registerNumericServiceExtension(
    name: 'timeDilation',
    getter: () => timeDilation,
    setter: (double value) {
      timeDilation = value;
    }
  );
}