implement static method

NSCacheDelegate implement({
  1. void cache_willEvictObject_(
    1. NSCache,
    2. ObjCObjectBase
    )?,
  2. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSCacheDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.

If $keepIsolateAlive is true, this protocol will keep this isolate alive until it is garbage collected by both Dart and ObjC.

Implementation

static NSCacheDelegate implement({
  void Function(NSCache, objc.ObjCObjectBase)? cache_willEvictObject_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSCacheDelegate');
  NSCacheDelegate.cache_willEvictObject_.implement(
    builder,
    cache_willEvictObject_,
  );
  builder.addProtocol($protocol);
  return NSCacheDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}