implementAsBlocking static method

NSStreamDelegate implementAsBlocking({
  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. All methods that can be implemented as blocking listeners will be.

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

Implementation

static NSStreamDelegate implementAsBlocking({
  void Function(NSStream, int)? stream_handleEvent_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSStreamDelegate');
  NSStreamDelegate$Builder.stream_handleEvent_.implementAsBlocking(
    builder,
    stream_handleEvent_,
  );
  builder.addProtocol($protocol);
  return NSStreamDelegate.as(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}