implement static method

NSStreamDelegate implement({
  1. void stream_handleEvent_(
    1. NSStream,
    2. int
    )?,
  2. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSStreamDelegate 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 NSStreamDelegate implement({
  void Function(NSStream, int)? stream_handleEvent_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSStreamDelegate');
  NSStreamDelegate$Builder.stream_handleEvent_.implement(
    builder,
    stream_handleEvent_,
  );
  builder.addProtocol($protocol);
  return NSStreamDelegate.as(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}