implementAsBlocking static method

NSAppearanceCustomization implementAsBlocking({
  1. required NSAppearance? appearance(),
  2. required void setAppearance_(
    1. NSAppearance?
    ),
  3. required NSAppearance effectiveAppearance(),
  4. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSAppearanceCustomization 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 NSAppearanceCustomization implementAsBlocking({
  required NSAppearance? Function() appearance,
  required void Function(NSAppearance?) setAppearance_,
  required NSAppearance Function() effectiveAppearance,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSAppearanceCustomization',
  );
  NSAppearanceCustomization.appearance.implement(builder, appearance);
  NSAppearanceCustomization.setAppearance_.implementAsBlocking(
    builder,
    setAppearance_,
  );
  NSAppearanceCustomization.effectiveAppearance.implement(
    builder,
    effectiveAppearance,
  );
  builder.addProtocol($protocol);
  return NSAppearanceCustomization.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}