IVersioned constructor

IVersioned(
  1. FbInterface self
)

Implementation

IVersioned(this.self) {
  if (self == nullptr) {
    throw FbClientException(
        "Attempt to create an interface from a null reference.");
  }
  vtable = FbInterface.fromAddress(self[1]);
  version = vtable[1];
  // both version and minSupportedVersion() will come from
  // the interface actually being instantiated
  // (possibly a descendant of IVersioned)
  if (version < minSupportedVersion()) {
    throw FbClientException(
        "${runtimeType.toString()}: interface version $version "
        "not supported (minimum supported version is ${minSupportedVersion()})");
  }
}