register<T extends ComInterface> static method
Registers a ComCompanion for the COM interface type T.
This enables runtime construction and identification of T.
A companion may only be registered once per type. Attempting to override a predefined companion will result in a StateError.
Example:
ComInterface.register<IExampleCom>(const IExampleComCompanion());
Implementation
static void register<T extends ComInterface>(ComCompanion<T> companion) {
if (_predefinedCompanions.containsKey(T)) {
throw StateError(
'Cannot override the predefined companion for $T. '
'Predefined companions are part of the core library.',
);
}
_registeredCompanions[T] = companion;
}