implement static method

NSProgressReporting implement({
  1. required NSProgress progress(),
  2. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSProgressReporting 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 NSProgressReporting implement({
  required objc.NSProgress Function() progress,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSProgressReporting');
  NSProgressReporting.progress.implement(builder, progress);
  builder.addProtocol($protocol);
  return NSProgressReporting.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}