Protocol constructor
Protocol(
- String protocolName
Implementation
factory Protocol(String protocolName) {
final protocolNamePtr = protocolName.toNativeUtf8();
Pointer<Void> ptr = objc_getProtocol(protocolNamePtr);
calloc.free(protocolNamePtr);
if (ptr == nullptr) {
throw 'Protocol($protocolName) doesn\'t exist or never used in native code! Cannot get Protocol by its name!';
}
if (_cache.containsKey(ptr.address)) {
return _cache[ptr.address]!;
} else {
return Protocol._internal(protocolName, ptr);
}
}