blob: fbcf77de84f45b71a6c0db5bed7ffde9d65ea6f8 [file]
// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
// ignore_for_file: type=lint, unused_import
@ffi.DefaultAsset('package:ffigen/objc_test')
library;
import 'dart:ffi' as ffi;
import 'package:objective_c/objective_c.dart' as objc;
import 'package:ffi/ffi.dart' as pkg_ffi;
@ffi.Native<
ffi.Int32 Function(ffi.Pointer<objc.ObjCObjectImpl>, ffi.Pointer<ffi.Void>)
>()
external int _13hhotk_protocolTrampoline_1d4mjzg(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
);
@ffi.Native<
instancetype Function(ffi.Pointer<objc.ObjCObjectImpl>, ffi.Pointer<ffi.Void>)
>()
external instancetype _13hhotk_protocolTrampoline_1mbt9g9(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
);
@ffi.Native<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>()
external void _13hhotk_protocolTrampoline_1pbq496(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
int arg1,
);
@ffi.Native<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
SomeStruct,
)
>()
external int _13hhotk_protocolTrampoline_1pfwxcz(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
SomeStruct arg1,
);
@ffi.Native<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Double,
)
>()
external ffi.Pointer<objc.ObjCObjectImpl> _13hhotk_protocolTrampoline_1s2pox8(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
double arg2,
);
@ffi.Native<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>()
external void _13hhotk_protocolTrampoline_8r9qkg(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
);
@ffi.Native<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>()
external int _13hhotk_protocolTrampoline_ct0ie0(
ffi.Pointer<objc.ObjCObjectImpl> target,
ffi.Pointer<ffi.Void> arg0,
int arg1,
int arg2,
int arg3,
int arg4,
);
@ffi.Native<
ffi.Pointer<objc.ObjCBlockImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<objc.DOBJC_Context>,
)
>(isLeaf: true)
external ffi.Pointer<objc.ObjCBlockImpl> _13hhotk_wrapBlockingBlock_1pbq496(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<objc.ObjCBlockImpl> listnerBlock,
ffi.Pointer<objc.DOBJC_Context> context,
);
@ffi.Native<
ffi.Pointer<objc.ObjCBlockImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<objc.DOBJC_Context>,
)
>(isLeaf: true)
external ffi.Pointer<objc.ObjCBlockImpl> _13hhotk_wrapBlockingBlock_8r9qkg(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<objc.ObjCBlockImpl> listnerBlock,
ffi.Pointer<objc.DOBJC_Context> context,
);
@ffi.Native<
ffi.Pointer<objc.ObjCBlockImpl> Function(ffi.Pointer<objc.ObjCBlockImpl>)
>(isLeaf: true)
external ffi.Pointer<objc.ObjCBlockImpl> _13hhotk_wrapListenerBlock_1pbq496(
ffi.Pointer<objc.ObjCBlockImpl> block,
);
@ffi.Native<
ffi.Pointer<objc.ObjCBlockImpl> Function(ffi.Pointer<objc.ObjCBlockImpl>)
>(isLeaf: true)
external ffi.Pointer<objc.ObjCBlockImpl> _13hhotk_wrapListenerBlock_8r9qkg(
ffi.Pointer<objc.ObjCBlockImpl> block,
);
@ffi.Native<ffi.Pointer<ffi.Void> Function(ffi.Pointer<objc.ObjCObjectImpl>)>(
symbol: 'getClass',
)
external ffi.Pointer<ffi.Void> _getClass(
ffi.Pointer<objc.ObjCObjectImpl> object,
);
ffi.Pointer<ffi.Void> getClass(objc.ObjCObject object) =>
_getClass(object.ref.pointer);
@ffi.Native<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>()
external ffi.Pointer<ffi.Char> getClassName(ffi.Pointer<ffi.Void> cls);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>()
external void objc_autoreleasePoolPop(ffi.Pointer<ffi.Void> pool);
@ffi.Native<ffi.Pointer<ffi.Void> Function()>()
external ffi.Pointer<ffi.Void> objc_autoreleasePoolPush();
/// EmptyProtocol
extension type EmptyProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol {
/// Constructs a [EmptyProtocol] that points to the same underlying object as [other].
EmptyProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [EmptyProtocol] that wraps the given raw object pointer.
EmptyProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
/// Returns whether [obj] is an instance of [EmptyProtocol].
static bool conformsTo(objc.ObjCObject obj) {
return _objc_msgSend_e3qsqz(
obj.ref.pointer,
_sel_conformsToProtocol_,
_protocol_EmptyProtocol,
);
}
}
extension EmptyProtocol$Methods on EmptyProtocol {}
interface class EmptyProtocol$Builder {
/// Returns the [objc.Protocol] object for this protocol.
static objc.Protocol get $protocol =>
objc.Protocol.fromPointer(_protocol_EmptyProtocol.cast());
/// Builds an object that implements the EmptyProtocol 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.
static EmptyProtocol implement({bool $keepIsolateAlive = true}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'EmptyProtocol');
builder.addProtocol($protocol);
return EmptyProtocol.as(builder.build(keepIsolateAlive: $keepIsolateAlive));
}
/// Adds the implementation of the EmptyProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder].
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilder(
objc.ObjCProtocolBuilder builder, {
bool $keepIsolateAlive = true,
}) {
builder.addProtocol($protocol);
}
}
/// WARNING: FilteredProtocol is a stub. To generate bindings for this class, include
/// FilteredProtocol in your config's objc-protocols list.
///
/// FilteredProtocol
extension type FilteredProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol {
/// Constructs a [FilteredProtocol] that points to the same underlying object as [other].
FilteredProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [FilteredProtocol] that wraps the given raw object pointer.
FilteredProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
}
/// MyProtocol
extension type MyProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol, SuperProtocol {
/// Constructs a [MyProtocol] that points to the same underlying object as [other].
MyProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [MyProtocol] that wraps the given raw object pointer.
MyProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
/// Returns whether [obj] is an instance of [MyProtocol].
static bool conformsTo(objc.ObjCObject obj) {
return _objc_msgSend_e3qsqz(
obj.ref.pointer,
_sel_conformsToProtocol_,
_protocol_MyProtocol,
);
}
}
extension MyProtocol$Methods on MyProtocol {
/// disabledMethod
int disabledMethod() {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_disabledMethod)) {
throw objc.UnimplementedOptionalMethodException(
'MyProtocol',
'disabledMethod',
);
}
return _objc_msgSend_1gcq84o(object$.ref.pointer, _sel_disabledMethod);
}
/// instanceMethod:withDouble:
objc.NSString instanceMethod(objc.NSString s, {required double withDouble}) {
final $ret = _objc_msgSend_6plvbo(
object$.ref.pointer,
_sel_instanceMethod_withDouble_,
s.ref.pointer,
withDouble,
);
return objc.NSString.fromPointer($ret, retain: true, release: true);
}
/// intPtrMethod:
void intPtrMethod(ffi.Pointer<ffi.Int32> ptr) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_intPtrMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'MyProtocol',
'intPtrMethod:',
);
}
_objc_msgSend_yhkuco(object$.ref.pointer, _sel_intPtrMethod_, ptr);
}
/// optionalMethod:
int optionalMethod(SomeStruct s) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_optionalMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'MyProtocol',
'optionalMethod:',
);
}
return _objc_msgSend_lacj97(object$.ref.pointer, _sel_optionalMethod_, s);
}
/// voidMethod:
void voidMethod(int x) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_voidMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'MyProtocol',
'voidMethod:',
);
}
_objc_msgSend_1bqef4y(object$.ref.pointer, _sel_voidMethod_, x);
}
}
interface class MyProtocol$Builder {
/// Returns the [objc.Protocol] object for this protocol.
static objc.Protocol get $protocol =>
objc.Protocol.fromPointer(_protocol_MyProtocol.cast());
/// Builds an object that implements the MyProtocol 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.
static MyProtocol implement({
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'MyProtocol');
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implement(builder, intPtrMethod_);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implement(builder, voidMethod_);
builder.addProtocol($protocol);
return MyProtocol.as(builder.build(keepIsolateAlive: $keepIsolateAlive));
}
/// Adds the implementation of the MyProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder].
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilder(
objc.ObjCProtocolBuilder builder, {
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implement(builder, intPtrMethod_);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implement(builder, voidMethod_);
builder.addProtocol($protocol);
}
/// Builds an object that implements the MyProtocol protocol. To implement
/// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. All
/// methods that can be implemented as listeners will be.
///
/// If `$keepIsolateAlive` is true, this protocol will keep this isolate
/// alive until it is garbage collected by both Dart and ObjC.
static MyProtocol implementAsListener({
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'MyProtocol');
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implementAsListener(
builder,
intPtrMethod_,
);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implementAsListener(builder, voidMethod_);
builder.addProtocol($protocol);
return MyProtocol.as(builder.build(keepIsolateAlive: $keepIsolateAlive));
}
/// Adds the implementation of the MyProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder]. All methods that can be implemented as listeners will
/// be.
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilderAsListener(
objc.ObjCProtocolBuilder builder, {
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implementAsListener(
builder,
intPtrMethod_,
);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implementAsListener(builder, voidMethod_);
builder.addProtocol($protocol);
}
/// Builds an object that implements the MyProtocol 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.
static MyProtocol implementAsBlocking({
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'MyProtocol');
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implementAsBlocking(
builder,
intPtrMethod_,
);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implementAsBlocking(builder, voidMethod_);
builder.addProtocol($protocol);
return MyProtocol.as(builder.build(keepIsolateAlive: $keepIsolateAlive));
}
/// Adds the implementation of the MyProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder]. All methods that can be implemented as blocking
/// listeners will be.
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilderAsBlocking(
objc.ObjCProtocolBuilder builder, {
int Function()? disabledMethod,
required objc.NSString Function(objc.NSString, double)
instanceMethod_withDouble_,
void Function(ffi.Pointer<ffi.Int32>)? intPtrMethod_,
int Function(SomeStruct)? optionalMethod_,
void Function(int)? voidMethod_,
bool $keepIsolateAlive = true,
}) {
MyProtocol$Builder.disabledMethod.implement(builder, disabledMethod);
MyProtocol$Builder.instanceMethod_withDouble_.implement(
builder,
instanceMethod_withDouble_,
);
MyProtocol$Builder.intPtrMethod_.implementAsBlocking(
builder,
intPtrMethod_,
);
MyProtocol$Builder.optionalMethod_.implement(builder, optionalMethod_);
MyProtocol$Builder.voidMethod_.implementAsBlocking(builder, voidMethod_);
builder.addProtocol($protocol);
}
/// disabledMethod
static final disabledMethod = objc.ObjCProtocolMethod<int Function()>(
_protocol_MyProtocol,
_sel_disabledMethod,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
)
>
>(_13hhotk_protocolTrampoline_1d4mjzg)
.cast(),
objc.getProtocolMethodSignature(
_protocol_MyProtocol,
_sel_disabledMethod,
isRequired: false,
isInstanceMethod: true,
),
(int Function() func) => ObjCBlock_Int32_ffiVoid.fromFunction(
(ffi.Pointer<ffi.Void> _) => func(),
),
);
/// instanceMethod:withDouble:
static final instanceMethod_withDouble_ =
objc.ObjCProtocolMethod<objc.NSString Function(objc.NSString, double)>(
_protocol_MyProtocol,
_sel_instanceMethod_withDouble_,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Double,
)
>
>(_13hhotk_protocolTrampoline_1s2pox8)
.cast(),
objc.getProtocolMethodSignature(
_protocol_MyProtocol,
_sel_instanceMethod_withDouble_,
isRequired: true,
isInstanceMethod: true,
),
(objc.NSString Function(objc.NSString, double) func) =>
ObjCBlock_NSString_ffiVoid_NSString_ffiDouble.fromFunction(
(ffi.Pointer<ffi.Void> _, objc.NSString arg1, double arg2) =>
func(arg1, arg2),
),
);
/// intPtrMethod:
static final intPtrMethod_ =
objc.ObjCProtocolListenableMethod<void Function(ffi.Pointer<ffi.Int32>)>(
_protocol_MyProtocol,
_sel_intPtrMethod_,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>
>(_13hhotk_protocolTrampoline_8r9qkg)
.cast(),
objc.getProtocolMethodSignature(
_protocol_MyProtocol,
_sel_intPtrMethod_,
isRequired: false,
isInstanceMethod: true,
),
(void Function(ffi.Pointer<ffi.Int32>) func) =>
ObjCBlock_ffiVoid_ffiVoid_Int32$1.fromFunction(
(ffi.Pointer<ffi.Void> _, ffi.Pointer<ffi.Int32> arg1) =>
func(arg1),
),
(void Function(ffi.Pointer<ffi.Int32>) func) =>
ObjCBlock_ffiVoid_ffiVoid_Int32$1.listener(
(ffi.Pointer<ffi.Void> _, ffi.Pointer<ffi.Int32> arg1) =>
func(arg1),
),
(void Function(ffi.Pointer<ffi.Int32>) func) =>
ObjCBlock_ffiVoid_ffiVoid_Int32$1.blocking(
(ffi.Pointer<ffi.Void> _, ffi.Pointer<ffi.Int32> arg1) =>
func(arg1),
),
);
/// optionalMethod:
static final optionalMethod_ =
objc.ObjCProtocolMethod<int Function(SomeStruct)>(
_protocol_MyProtocol,
_sel_optionalMethod_,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
SomeStruct,
)
>
>(_13hhotk_protocolTrampoline_1pfwxcz)
.cast(),
objc.getProtocolMethodSignature(
_protocol_MyProtocol,
_sel_optionalMethod_,
isRequired: false,
isInstanceMethod: true,
),
(int Function(SomeStruct) func) =>
ObjCBlock_Int32_ffiVoid_SomeStruct.fromFunction(
(ffi.Pointer<ffi.Void> _, SomeStruct arg1) => func(arg1),
),
);
/// voidMethod:
static final voidMethod_ =
objc.ObjCProtocolListenableMethod<void Function(int)>(
_protocol_MyProtocol,
_sel_voidMethod_,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>
>(_13hhotk_protocolTrampoline_1pbq496)
.cast(),
objc.getProtocolMethodSignature(
_protocol_MyProtocol,
_sel_voidMethod_,
isRequired: false,
isInstanceMethod: true,
),
(void Function(int) func) =>
ObjCBlock_ffiVoid_ffiVoid_Int32.fromFunction(
(ffi.Pointer<ffi.Void> _, int arg1) => func(arg1),
),
(void Function(int) func) => ObjCBlock_ffiVoid_ffiVoid_Int32.listener(
(ffi.Pointer<ffi.Void> _, int arg1) => func(arg1),
),
(void Function(int) func) => ObjCBlock_ffiVoid_ffiVoid_Int32.blocking(
(ffi.Pointer<ffi.Void> _, int arg1) => func(arg1),
),
);
}
/// Construction methods for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>`.
abstract final class ObjCBlock_Int32_ffiVoid {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)> fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>(
pointer,
retain: retain,
release: release,
);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<ffi.Int32 Function(ffi.Pointer<ffi.Void> arg0)>
>
ptr,
) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)> fromFunction(
int Function(ffi.Pointer<ffi.Void>) fn, {
bool keepIsolateAlive = true,
}) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0) => fn(arg0),
keepIsolateAlive,
),
retain: false,
release: true,
);
static int _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) => block.ref.target
.cast<
ffi.NativeFunction<ffi.Int32 Function(ffi.Pointer<ffi.Void> arg0)>
>()
.asFunction<int Function(ffi.Pointer<ffi.Void>)>()(arg0);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_fnPtrTrampoline, 0)
.cast();
static int _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) => (objc.getBlockClosure(block) as int Function(ffi.Pointer<ffi.Void>))(
arg0,
);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_closureTrampoline, 0)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)>`.
extension ObjCBlock_Int32_ffiVoid$CallExtension
on objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>)> {
int call(ffi.Pointer<ffi.Void> arg0) => ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
)
>
>()
.asFunction<
int Function(ffi.Pointer<objc.ObjCBlockImpl>, ffi.Pointer<ffi.Void>)
>()(ref.pointer, arg0);
}
/// Construction methods for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32)>`.
abstract final class ObjCBlock_Int32_ffiVoid_Int32_Int32_Int32_Int32 {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) =>
objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>(pointer, retain: retain, release: release);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Int32 arg1,
ffi.Int32 arg2,
ffi.Int32 arg3,
ffi.Int32 arg4,
)
>
>
ptr,
) =>
objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>
fromFunction(
int Function(ffi.Pointer<ffi.Void>, int, int, int, int) fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>(
objc.newClosureBlock(
_closureCallable,
(
ffi.Pointer<ffi.Void> arg0,
int arg1,
int arg2,
int arg3,
int arg4,
) => fn(arg0, arg1, arg2, arg3, arg4),
keepIsolateAlive,
),
retain: false,
release: true,
);
static int _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
int arg1,
int arg2,
int arg3,
int arg4,
) => block.ref.target
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Int32 arg1,
ffi.Int32 arg2,
ffi.Int32 arg3,
ffi.Int32 arg4,
)
>
>()
.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, int, int, int)
>()(arg0, arg1, arg2, arg3, arg4);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>(_fnPtrTrampoline, 0)
.cast();
static int _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
int arg1,
int arg2,
int arg3,
int arg4,
) =>
(objc.getBlockClosure(block)
as int Function(ffi.Pointer<ffi.Void>, int, int, int, int))(
arg0,
arg1,
arg2,
arg3,
arg4,
);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>(_closureTrampoline, 0)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, ffi.Int32, ffi.Int32, ffi.Int32, ffi.Int32)>`.
extension ObjCBlock_Int32_ffiVoid_Int32_Int32_Int32_Int32$CallExtension
on
objc.ObjCBlock<
ffi.Int32 Function(
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
> {
int call(
ffi.Pointer<ffi.Void> arg0,
int arg1,
int arg2,
int arg3,
int arg4,
) => ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Int32 arg1,
ffi.Int32 arg2,
ffi.Int32 arg3,
ffi.Int32 arg4,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
int,
int,
int,
int,
)
>()(ref.pointer, arg0, arg1, arg2, arg3, arg4);
}
/// Construction methods for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>`.
abstract final class ObjCBlock_Int32_ffiVoid_SomeStruct {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>(
pointer,
retain: retain,
release: release,
);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Int32 Function(ffi.Pointer<ffi.Void> arg0, SomeStruct arg1)
>
>
ptr,
) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>
fromFunction(
int Function(ffi.Pointer<ffi.Void>, SomeStruct) fn, {
bool keepIsolateAlive = true,
}) => objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0, SomeStruct arg1) => fn(arg0, arg1),
keepIsolateAlive,
),
retain: false,
release: true,
);
static int _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
SomeStruct arg1,
) =>
block.ref.target
.cast<
ffi.NativeFunction<
ffi.Int32 Function(ffi.Pointer<ffi.Void> arg0, SomeStruct arg1)
>
>()
.asFunction<int Function(ffi.Pointer<ffi.Void>, SomeStruct)>()(
arg0,
arg1,
);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
SomeStruct,
)
>(_fnPtrTrampoline, 0)
.cast();
static int _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
SomeStruct arg1,
) =>
(objc.getBlockClosure(block)
as int Function(ffi.Pointer<ffi.Void>, SomeStruct))(arg0, arg1);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
SomeStruct,
)
>(_closureTrampoline, 0)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)>`.
extension ObjCBlock_Int32_ffiVoid_SomeStruct$CallExtension
on objc.ObjCBlock<ffi.Int32 Function(ffi.Pointer<ffi.Void>, SomeStruct)> {
int call(ffi.Pointer<ffi.Void> arg0, SomeStruct arg1) => ref
.pointer
.ref
.invoke
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
SomeStruct arg1,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
SomeStruct,
)
>()(ref.pointer, arg0, arg1);
}
/// Construction methods for `objc.ObjCBlock<objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)>`.
abstract final class ObjCBlock_NSString_ffiVoid_NSString_ffiDouble {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) =>
objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>(pointer, retain: retain, release: release);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
ffi.Double arg2,
)
>
>
ptr,
) =>
objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>
fromFunction(
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, double) fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)
>(
objc.newClosureBlock(
_closureCallable,
(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
double arg2,
) => fn(
arg0,
objc.NSString.fromPointer(arg1, retain: true, release: true),
arg2,
).ref.retainAndAutorelease(),
keepIsolateAlive,
),
retain: false,
release: true,
);
static ffi.Pointer<objc.ObjCObjectImpl> _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
double arg2,
) => block.ref.target
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
ffi.Double arg2,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
double,
)
>()(arg0, arg1, arg2);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Double,
)
>(_fnPtrTrampoline)
.cast();
static ffi.Pointer<objc.ObjCObjectImpl> _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
double arg2,
) =>
(objc.getBlockClosure(block)
as ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
double,
))(arg0, arg1, arg2);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Double,
)
>(_closureTrampoline)
.cast();
}
/// Call operator for `objc.ObjCBlock<objc.NSString Function(ffi.Pointer<ffi.Void>, objc.NSString, ffi.Double)>`.
extension ObjCBlock_NSString_ffiVoid_NSString_ffiDouble$CallExtension
on
objc.ObjCBlock<
objc.NSString Function(
ffi.Pointer<ffi.Void>,
objc.NSString,
ffi.Double,
)
> {
objc.NSString call(
ffi.Pointer<ffi.Void> arg0,
objc.NSString arg1,
double arg2,
) => objc.NSString.fromPointer(
ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObjectImpl> arg1,
ffi.Double arg2,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<objc.ObjCObjectImpl>,
double,
)
>()(ref.pointer, arg0, arg1.ref.pointer, arg2),
retain: true,
release: true,
);
}
/// Construction methods for `objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>`.
abstract final class ObjCBlock_ffiVoid_ffiVoid_Int32 {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) => objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>(
pointer,
retain: retain,
release: release,
);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void> arg0, ffi.Int32 arg1)
>
>
ptr,
) => objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>
fromFunction(
void Function(ffi.Pointer<ffi.Void>, int) fn, {
bool keepIsolateAlive = true,
}) => objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0, int arg1) => fn(arg0, arg1),
keepIsolateAlive,
),
retain: false,
release: true,
);
/// Creates a listener block from a Dart function.
///
/// This is based on FFI's NativeCallable.listener, and has the same
/// capabilities and limitations. This block can be invoked from any thread,
/// but only supports void functions, and is not run synchronously. See
/// NativeCallable.listener for more details.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>
listener(
void Function(ffi.Pointer<ffi.Void>, int) fn, {
bool keepIsolateAlive = true,
}) {
final raw = objc.newClosureBlock(
_listenerCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, int arg1) => fn(arg0, arg1),
keepIsolateAlive,
);
final wrapper = _13hhotk_wrapListenerBlock_1pbq496(raw);
objc.objectRelease(raw.cast());
return objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>(
wrapper,
retain: false,
release: true,
);
}
/// Creates a blocking block from a Dart function.
///
/// This callback can be invoked from any native thread, and will block the
/// caller until the callback is handled by the Dart isolate that created
/// the block. Async functions are not supported.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC. If the owner isolate
/// has shut down, and the block is invoked by native code, it may block
/// indefinitely, or have other undefined behavior.
static objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>
blocking(
void Function(ffi.Pointer<ffi.Void>, int) fn, {
bool keepIsolateAlive = true,
}) {
final raw = objc.newClosureBlock(
_blockingCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, int arg1) => fn(arg0, arg1),
keepIsolateAlive,
);
final rawListener = objc.newClosureBlock(
_blockingListenerCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, int arg1) => fn(arg0, arg1),
keepIsolateAlive,
);
final wrapper = _13hhotk_wrapBlockingBlock_1pbq496(
raw,
rawListener,
objc.objCContext,
);
objc.objectRelease(raw.cast());
objc.objectRelease(rawListener.cast());
return objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>(
wrapper,
retain: false,
release: true,
);
}
static void _listenerTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
int arg1,
) {
(objc.getBlockClosure(block) as void Function(ffi.Pointer<ffi.Void>, int))(
arg0,
arg1,
);
objc.objectRelease(block.cast());
}
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>
_listenerCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>.listener(_listenerTrampoline)
..keepIsolateAlive = false;
static void _blockingTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> waiter,
ffi.Pointer<ffi.Void> arg0,
int arg1,
) {
try {
(objc.getBlockClosure(block)
as void Function(ffi.Pointer<ffi.Void>, int))(arg0, arg1);
} catch (e) {
} finally {
objc.signalWaiter(waiter);
objc.objectRelease(block.cast());
}
}
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>
_blockingCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>.isolateLocal(_blockingTrampoline)
..keepIsolateAlive = false;
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>
_blockingListenerCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>.listener(_blockingTrampoline)
..keepIsolateAlive = false;
static void _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
int arg1,
) => block.ref.target
.cast<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void> arg0, ffi.Int32 arg1)
>
>()
.asFunction<void Function(ffi.Pointer<ffi.Void>, int)>()(arg0, arg1);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>(_fnPtrTrampoline)
.cast();
static void _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
int arg1,
) =>
(objc.getBlockClosure(block)
as void Function(ffi.Pointer<ffi.Void>, int))(arg0, arg1);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
)
>(_closureTrampoline)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)>`.
extension ObjCBlock_ffiVoid_ffiVoid_Int32$CallExtension
on objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int32)> {
void call(ffi.Pointer<ffi.Void> arg0, int arg1) => ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Int32 arg1,
)
>
>()
.asFunction<
void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
int,
)
>()(ref.pointer, arg0, arg1);
}
/// Construction methods for `objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)>`.
abstract final class ObjCBlock_ffiVoid_ffiVoid_Int32$1 {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) =>
objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>(pointer, retain: retain, release: release);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
)
>
>
ptr,
) =>
objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>
fromFunction(
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>) fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0, ffi.Pointer<ffi.Int32> arg1) =>
fn(arg0, arg1),
keepIsolateAlive,
),
retain: false,
release: true,
);
/// Creates a listener block from a Dart function.
///
/// This is based on FFI's NativeCallable.listener, and has the same
/// capabilities and limitations. This block can be invoked from any thread,
/// but only supports void functions, and is not run synchronously. See
/// NativeCallable.listener for more details.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>
listener(
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>) fn, {
bool keepIsolateAlive = true,
}) {
final raw = objc.newClosureBlock(
_listenerCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, ffi.Pointer<ffi.Int32> arg1) =>
fn(arg0, arg1),
keepIsolateAlive,
);
final wrapper = _13hhotk_wrapListenerBlock_8r9qkg(raw);
objc.objectRelease(raw.cast());
return objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>(wrapper, retain: false, release: true);
}
/// Creates a blocking block from a Dart function.
///
/// This callback can be invoked from any native thread, and will block the
/// caller until the callback is handled by the Dart isolate that created
/// the block. Async functions are not supported.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC. If the owner isolate
/// has shut down, and the block is invoked by native code, it may block
/// indefinitely, or have other undefined behavior.
static objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>
blocking(
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>) fn, {
bool keepIsolateAlive = true,
}) {
final raw = objc.newClosureBlock(
_blockingCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, ffi.Pointer<ffi.Int32> arg1) =>
fn(arg0, arg1),
keepIsolateAlive,
);
final rawListener = objc.newClosureBlock(
_blockingListenerCallable.nativeFunction.cast(),
(ffi.Pointer<ffi.Void> arg0, ffi.Pointer<ffi.Int32> arg1) =>
fn(arg0, arg1),
keepIsolateAlive,
);
final wrapper = _13hhotk_wrapBlockingBlock_8r9qkg(
raw,
rawListener,
objc.objCContext,
);
objc.objectRelease(raw.cast());
objc.objectRelease(rawListener.cast());
return objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>(wrapper, retain: false, release: true);
}
static void _listenerTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
) {
(objc.getBlockClosure(block)
as void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>))(
arg0,
arg1,
);
objc.objectRelease(block.cast());
}
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>
_listenerCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>.listener(_listenerTrampoline)
..keepIsolateAlive = false;
static void _blockingTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> waiter,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
) {
try {
(objc.getBlockClosure(block)
as void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>))(
arg0,
arg1,
);
} catch (e) {
} finally {
objc.signalWaiter(waiter);
objc.objectRelease(block.cast());
}
}
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>
_blockingCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>.isolateLocal(_blockingTrampoline)
..keepIsolateAlive = false;
static ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>
_blockingListenerCallable =
ffi.NativeCallable<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>.listener(_blockingTrampoline)
..keepIsolateAlive = false;
static void _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
) => block.ref.target
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
)
>
>()
.asFunction<
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
>()(arg0, arg1);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>(_fnPtrTrampoline)
.cast();
static void _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
) =>
(objc.getBlockClosure(block)
as void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>))(
arg0,
arg1,
);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>(_closureTrampoline)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)>`.
extension ObjCBlock_ffiVoid_ffiVoid_Int32$1$CallExtension
on
objc.ObjCBlock<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Int32>)
> {
void call(ffi.Pointer<ffi.Void> arg0, ffi.Pointer<ffi.Int32> arg1) => ref
.pointer
.ref
.invoke
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<ffi.Int32> arg1,
)
>
>()
.asFunction<
void Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Int32>,
)
>()(ref.pointer, arg0, arg1);
}
/// Construction methods for `objc.ObjCBlock<ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)>`.
abstract final class ObjCBlock_idMyProtocol_ffiVoid {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>(pointer, retain: retain, release: release);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void> arg0)
>
>
ptr,
) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>
fromFunction(
MyProtocol Function(ffi.Pointer<ffi.Void>) fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0) => fn(arg0).ref.retainAndAutorelease(),
keepIsolateAlive,
),
retain: false,
release: true,
);
static ffi.Pointer<objc.ObjCObjectImpl> _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) => block.ref.target
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void> arg0)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
>()(arg0);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_fnPtrTrampoline)
.cast();
static ffi.Pointer<objc.ObjCObjectImpl> _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) =>
(objc.getBlockClosure(block)
as ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>))(
arg0,
);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_closureTrampoline)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)>`.
extension ObjCBlock_idMyProtocol_ffiVoid$CallExtension
on
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void>)
> {
MyProtocol call(ffi.Pointer<ffi.Void> arg0) => MyProtocol.fromPointer(
ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>()(ref.pointer, arg0),
retain: true,
release: true,
);
}
/// Construction methods for `objc.ObjCBlock<ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)>`.
abstract final class ObjCBlock_instancetype_ffiVoid {
/// Returns a block that wraps the given raw block pointer.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>
fromPointer(
ffi.Pointer<objc.ObjCBlockImpl> pointer, {
bool retain = false,
bool release = false,
}) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>(pointer, retain: retain, release: release);
/// Creates a block from a C function pointer.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>
fromFunctionPointer(
ffi.Pointer<
ffi.NativeFunction<instancetype Function(ffi.Pointer<ffi.Void> arg0)>
>
ptr,
) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>(
objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
retain: false,
release: true,
);
/// Creates a block from a Dart function.
///
/// This block must be invoked by native code running on the same thread as
/// the isolate that registered it. Invoking the block on the wrong thread
/// will result in a crash.
///
/// If `keepIsolateAlive` is true, this block will keep this isolate alive
/// until it is garbage collected by both Dart and ObjC.
static objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>
fromFunction(
Dartinstancetype? Function(ffi.Pointer<ffi.Void>) fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
>(
objc.newClosureBlock(
_closureCallable,
(ffi.Pointer<ffi.Void> arg0) =>
fn(arg0)?.ref.retainAndAutorelease() ?? ffi.nullptr,
keepIsolateAlive,
),
retain: false,
release: true,
);
static instancetype _fnPtrTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) => block.ref.target
.cast<
ffi.NativeFunction<instancetype Function(ffi.Pointer<ffi.Void> arg0)>
>()
.asFunction<instancetype Function(ffi.Pointer<ffi.Void>)>()(arg0);
static ffi.Pointer<ffi.Void> _fnPtrCallable =
ffi.Pointer.fromFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_fnPtrTrampoline)
.cast();
static instancetype _closureTrampoline(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
) =>
(objc.getBlockClosure(block)
as instancetype Function(ffi.Pointer<ffi.Void>))(arg0);
static ffi.Pointer<ffi.Void> _closureCallable =
ffi.Pointer.fromFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>(_closureTrampoline)
.cast();
}
/// Call operator for `objc.ObjCBlock<ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)>`.
extension ObjCBlock_instancetype_ffiVoid$CallExtension
on
objc.ObjCBlock<
ffi.Pointer<objc.ObjCObjectImpl>? Function(ffi.Pointer<ffi.Void>)
> {
Dartinstancetype? call(ffi.Pointer<ffi.Void> arg0) =>
ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
)
>
>()
.asFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>()(ref.pointer, arg0)
.address ==
0
? null
: objc.ObjCObject(
ref.pointer.ref.invoke
.cast<
ffi.NativeFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl> block,
ffi.Pointer<ffi.Void> arg0,
)
>
>()
.asFunction<
instancetype Function(
ffi.Pointer<objc.ObjCBlockImpl>,
ffi.Pointer<ffi.Void>,
)
>()(ref.pointer, arg0),
retain: true,
release: true,
);
}
/// ObjCProtocolImpl
extension type ObjCProtocolImpl._(objc.ObjCObject object$)
implements
objc.ObjCObject,
objc.NSObject,
MyProtocol,
SecondaryProtocol,
FilteredProtocol {
/// Constructs a [ObjCProtocolImpl] that points to the same underlying object as [other].
ObjCProtocolImpl.as(objc.ObjCObject other) : object$ = other {
assert(isA(object$));
}
/// Constructs a [ObjCProtocolImpl] that wraps the given raw object pointer.
ObjCProtocolImpl.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCObject(other, retain: retain, release: release) {
assert(isA(object$));
}
/// Returns whether [obj] is an instance of [ObjCProtocolImpl].
static bool isA(objc.ObjCObject? obj) => obj == null
? false
: _objc_msgSend_19nvye5(
obj.ref.pointer,
_sel_isKindOfClass_,
_class_ObjCProtocolImpl,
);
/// alloc
static ObjCProtocolImpl alloc() {
final $ret = _objc_msgSend_151sglz(_class_ObjCProtocolImpl, _sel_alloc);
return ObjCProtocolImpl.fromPointer($ret, retain: false, release: true);
}
/// allocWithZone:
static ObjCProtocolImpl allocWithZone(ffi.Pointer<objc.NSZone> zone) {
final $ret = _objc_msgSend_1cwp428(
_class_ObjCProtocolImpl,
_sel_allocWithZone_,
zone,
);
return ObjCProtocolImpl.fromPointer($ret, retain: false, release: true);
}
/// new
static ObjCProtocolImpl new$() {
final $ret = _objc_msgSend_151sglz(_class_ObjCProtocolImpl, _sel_new);
return ObjCProtocolImpl.fromPointer($ret, retain: false, release: true);
}
/// optionalClassMethod
static int optionalClassMethod() {
if (!objc.respondsToSelector(
_class_ObjCProtocolImpl,
_sel_optionalClassMethod,
)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'optionalClassMethod',
);
}
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImpl,
_sel_optionalClassMethod,
);
}
/// requiredClassMethod
static int requiredClassMethod() {
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImpl,
_sel_requiredClassMethod,
);
}
/// unimplementedOtionalClassMethod
static int unimplementedOtionalClassMethod() {
if (!objc.respondsToSelector(
_class_ObjCProtocolImpl,
_sel_unimplementedOtionalClassMethod,
)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'unimplementedOtionalClassMethod',
);
}
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImpl,
_sel_unimplementedOtionalClassMethod,
);
}
/// Returns a new instance of ObjCProtocolImpl constructed with the default `new` method.
ObjCProtocolImpl() : this.as(new$().object$);
}
extension ObjCProtocolImpl$Methods on ObjCProtocolImpl {
/// disabledMethod
int disabledMethod() {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_disabledMethod)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'disabledMethod',
);
}
return _objc_msgSend_1gcq84o(object$.ref.pointer, _sel_disabledMethod);
}
/// fooMethod
int fooMethod() {
return _objc_msgSend_1gcq84o(object$.ref.pointer, _sel_fooMethod);
}
/// init
ObjCProtocolImpl init() {
objc.checkOsVersionInternal(
'ObjCProtocolImpl.init',
iOS: (false, (2, 0, 0)),
macOS: (false, (10, 0, 0)),
);
final $ret = _objc_msgSend_151sglz(
object$.ref.retainAndReturnPointer(),
_sel_init,
);
return ObjCProtocolImpl.fromPointer($ret, retain: false, release: true);
}
/// instanceMethod:withDouble:
objc.NSString instanceMethod(objc.NSString s, {required double withDouble}) {
final $ret = _objc_msgSend_6plvbo(
object$.ref.pointer,
_sel_instanceMethod_withDouble_,
s.ref.pointer,
withDouble,
);
return objc.NSString.fromPointer($ret, retain: true, release: true);
}
/// intPtrMethod:
void intPtrMethod(ffi.Pointer<ffi.Int32> ptr) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_intPtrMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'intPtrMethod:',
);
}
_objc_msgSend_yhkuco(object$.ref.pointer, _sel_intPtrMethod_, ptr);
}
/// optionalMethod:
int optionalMethod(SomeStruct s) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_optionalMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'optionalMethod:',
);
}
return _objc_msgSend_lacj97(object$.ref.pointer, _sel_optionalMethod_, s);
}
/// otherMethod:b:c:d:
int otherMethod(int a, {required int b, required int c, required int d}) {
return _objc_msgSend_hv8ra8(
object$.ref.pointer,
_sel_otherMethod_b_c_d_,
a,
b,
c,
d,
);
}
/// returnsInstanceType
ObjCProtocolImpl? returnsInstanceType() {
if (!objc.respondsToSelector(
object$.ref.pointer,
_sel_returnsInstanceType,
)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'returnsInstanceType',
);
}
final $ret = _objc_msgSend_151sglz(
object$.ref.pointer,
_sel_returnsInstanceType,
);
return $ret.address == 0
? null
: ObjCProtocolImpl.fromPointer($ret, retain: true, release: true);
}
/// returnsMyProtocol
MyProtocol returnsMyProtocol() {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_returnsMyProtocol)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'returnsMyProtocol',
);
}
final $ret = _objc_msgSend_151sglz(
object$.ref.pointer,
_sel_returnsMyProtocol,
);
return MyProtocol.fromPointer($ret, retain: true, release: true);
}
/// voidMethod:
void voidMethod(int x) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_voidMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImpl',
'voidMethod:',
);
}
_objc_msgSend_1bqef4y(object$.ref.pointer, _sel_voidMethod_, x);
}
}
/// ObjCProtocolImplMissingMethod
extension type ObjCProtocolImplMissingMethod._(objc.ObjCObject object$)
implements objc.ObjCObject, objc.NSObject, MyProtocol {
/// Constructs a [ObjCProtocolImplMissingMethod] that points to the same underlying object as [other].
ObjCProtocolImplMissingMethod.as(objc.ObjCObject other) : object$ = other {
assert(isA(object$));
}
/// Constructs a [ObjCProtocolImplMissingMethod] that wraps the given raw object pointer.
ObjCProtocolImplMissingMethod.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCObject(other, retain: retain, release: release) {
assert(isA(object$));
}
/// Returns whether [obj] is an instance of [ObjCProtocolImplMissingMethod].
static bool isA(objc.ObjCObject? obj) => obj == null
? false
: _objc_msgSend_19nvye5(
obj.ref.pointer,
_sel_isKindOfClass_,
_class_ObjCProtocolImplMissingMethod,
);
/// alloc
static ObjCProtocolImplMissingMethod alloc() {
final $ret = _objc_msgSend_151sglz(
_class_ObjCProtocolImplMissingMethod,
_sel_alloc,
);
return ObjCProtocolImplMissingMethod.fromPointer(
$ret,
retain: false,
release: true,
);
}
/// allocWithZone:
static ObjCProtocolImplMissingMethod allocWithZone(
ffi.Pointer<objc.NSZone> zone,
) {
final $ret = _objc_msgSend_1cwp428(
_class_ObjCProtocolImplMissingMethod,
_sel_allocWithZone_,
zone,
);
return ObjCProtocolImplMissingMethod.fromPointer(
$ret,
retain: false,
release: true,
);
}
/// new
static ObjCProtocolImplMissingMethod new$() {
final $ret = _objc_msgSend_151sglz(
_class_ObjCProtocolImplMissingMethod,
_sel_new,
);
return ObjCProtocolImplMissingMethod.fromPointer(
$ret,
retain: false,
release: true,
);
}
/// optionalClassMethod
static int optionalClassMethod() {
if (!objc.respondsToSelector(
_class_ObjCProtocolImplMissingMethod,
_sel_optionalClassMethod,
)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'optionalClassMethod',
);
}
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImplMissingMethod,
_sel_optionalClassMethod,
);
}
/// requiredClassMethod
static int requiredClassMethod() {
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImplMissingMethod,
_sel_requiredClassMethod,
);
}
/// unimplementedOtionalClassMethod
static int unimplementedOtionalClassMethod() {
if (!objc.respondsToSelector(
_class_ObjCProtocolImplMissingMethod,
_sel_unimplementedOtionalClassMethod,
)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'unimplementedOtionalClassMethod',
);
}
return _objc_msgSend_1gcq84o(
_class_ObjCProtocolImplMissingMethod,
_sel_unimplementedOtionalClassMethod,
);
}
/// Returns a new instance of ObjCProtocolImplMissingMethod constructed with the default `new` method.
ObjCProtocolImplMissingMethod() : this.as(new$().object$);
}
extension ObjCProtocolImplMissingMethod$Methods
on ObjCProtocolImplMissingMethod {
/// disabledMethod
int disabledMethod() {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_disabledMethod)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'disabledMethod',
);
}
return _objc_msgSend_1gcq84o(object$.ref.pointer, _sel_disabledMethod);
}
/// init
ObjCProtocolImplMissingMethod init() {
objc.checkOsVersionInternal(
'ObjCProtocolImplMissingMethod.init',
iOS: (false, (2, 0, 0)),
macOS: (false, (10, 0, 0)),
);
final $ret = _objc_msgSend_151sglz(
object$.ref.retainAndReturnPointer(),
_sel_init,
);
return ObjCProtocolImplMissingMethod.fromPointer(
$ret,
retain: false,
release: true,
);
}
/// instanceMethod:withDouble:
objc.NSString instanceMethod(objc.NSString s, {required double withDouble}) {
final $ret = _objc_msgSend_6plvbo(
object$.ref.pointer,
_sel_instanceMethod_withDouble_,
s.ref.pointer,
withDouble,
);
return objc.NSString.fromPointer($ret, retain: true, release: true);
}
/// intPtrMethod:
void intPtrMethod(ffi.Pointer<ffi.Int32> ptr) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_intPtrMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'intPtrMethod:',
);
}
_objc_msgSend_yhkuco(object$.ref.pointer, _sel_intPtrMethod_, ptr);
}
/// optionalMethod:
int optionalMethod(SomeStruct s) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_optionalMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'optionalMethod:',
);
}
return _objc_msgSend_lacj97(object$.ref.pointer, _sel_optionalMethod_, s);
}
/// voidMethod:
void voidMethod(int x) {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_voidMethod_)) {
throw objc.UnimplementedOptionalMethodException(
'ObjCProtocolImplMissingMethod',
'voidMethod:',
);
}
_objc_msgSend_1bqef4y(object$.ref.pointer, _sel_voidMethod_, x);
}
}
/// ProtocolConsumer
extension type ProtocolConsumer._(objc.ObjCObject object$)
implements objc.ObjCObject, objc.NSObject {
/// Constructs a [ProtocolConsumer] that points to the same underlying object as [other].
ProtocolConsumer.as(objc.ObjCObject other) : object$ = other {
assert(isA(object$));
}
/// Constructs a [ProtocolConsumer] that wraps the given raw object pointer.
ProtocolConsumer.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCObject(other, retain: retain, release: release) {
assert(isA(object$));
}
/// Returns whether [obj] is an instance of [ProtocolConsumer].
static bool isA(objc.ObjCObject? obj) => obj == null
? false
: _objc_msgSend_19nvye5(
obj.ref.pointer,
_sel_isKindOfClass_,
_class_ProtocolConsumer,
);
/// alloc
static ProtocolConsumer alloc() {
final $ret = _objc_msgSend_151sglz(_class_ProtocolConsumer, _sel_alloc);
return ProtocolConsumer.fromPointer($ret, retain: false, release: true);
}
/// allocWithZone:
static ProtocolConsumer allocWithZone(ffi.Pointer<objc.NSZone> zone) {
final $ret = _objc_msgSend_1cwp428(
_class_ProtocolConsumer,
_sel_allocWithZone_,
zone,
);
return ProtocolConsumer.fromPointer($ret, retain: false, release: true);
}
/// new
static ProtocolConsumer new$() {
final $ret = _objc_msgSend_151sglz(_class_ProtocolConsumer, _sel_new);
return ProtocolConsumer.fromPointer($ret, retain: false, release: true);
}
/// Returns a new instance of ProtocolConsumer constructed with the default `new` method.
ProtocolConsumer() : this.as(new$().object$);
}
extension ProtocolConsumer$Methods on ProtocolConsumer {
/// callBlockingMethodOnRandomThread:
void callBlockingMethodOnRandomThread(MyProtocol protocol) {
_objc_msgSend_xtuoz7(
object$.ref.pointer,
_sel_callBlockingMethodOnRandomThread_,
protocol.ref.pointer,
);
}
/// callInstanceMethod:
objc.NSString callInstanceMethod(SuperProtocol protocol) {
final $ret = _objc_msgSend_1sotr3r(
object$.ref.pointer,
_sel_callInstanceMethod_,
protocol.ref.pointer,
);
return objc.NSString.fromPointer($ret, retain: true, release: true);
}
/// callMethodOnRandomThread:
void callMethodOnRandomThread(MyProtocol protocol) {
_objc_msgSend_xtuoz7(
object$.ref.pointer,
_sel_callMethodOnRandomThread_,
protocol.ref.pointer,
);
}
/// callOptionalMethod:
int callOptionalMethod(MyProtocol protocol) {
return _objc_msgSend_fd28sq(
object$.ref.pointer,
_sel_callOptionalMethod_,
protocol.ref.pointer,
);
}
/// callOtherMethod:
int callOtherMethod(SecondaryProtocol protocol) {
return _objc_msgSend_fd28sq(
object$.ref.pointer,
_sel_callOtherMethod_,
protocol.ref.pointer,
);
}
/// callTwoMethods:
int callTwoMethods(MyProtocol protocol) {
return _objc_msgSend_fd28sq(
object$.ref.pointer,
_sel_callTwoMethods_,
protocol.ref.pointer,
);
}
/// init
ProtocolConsumer init() {
objc.checkOsVersionInternal(
'ProtocolConsumer.init',
iOS: (false, (2, 0, 0)),
macOS: (false, (10, 0, 0)),
);
final $ret = _objc_msgSend_151sglz(
object$.ref.retainAndReturnPointer(),
_sel_init,
);
return ProtocolConsumer.fromPointer($ret, retain: false, release: true);
}
}
/// SecondaryProtocol
extension type SecondaryProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol, objc.NSObjectProtocol {
/// Constructs a [SecondaryProtocol] that points to the same underlying object as [other].
SecondaryProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [SecondaryProtocol] that wraps the given raw object pointer.
SecondaryProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
/// Returns whether [obj] is an instance of [SecondaryProtocol].
static bool conformsTo(objc.ObjCObject obj) {
return _objc_msgSend_e3qsqz(
obj.ref.pointer,
_sel_conformsToProtocol_,
_protocol_SecondaryProtocol,
);
}
}
extension SecondaryProtocol$Methods on SecondaryProtocol {
/// otherMethod:b:c:d:
int otherMethod(int a, {required int b, required int c, required int d}) {
return _objc_msgSend_hv8ra8(
object$.ref.pointer,
_sel_otherMethod_b_c_d_,
a,
b,
c,
d,
);
}
/// returnsInstanceType
SecondaryProtocol? returnsInstanceType() {
if (!objc.respondsToSelector(
object$.ref.pointer,
_sel_returnsInstanceType,
)) {
throw objc.UnimplementedOptionalMethodException(
'SecondaryProtocol',
'returnsInstanceType',
);
}
final $ret = _objc_msgSend_151sglz(
object$.ref.pointer,
_sel_returnsInstanceType,
);
return $ret.address == 0
? null
: SecondaryProtocol.fromPointer($ret, retain: true, release: true);
}
/// returnsMyProtocol
MyProtocol returnsMyProtocol() {
if (!objc.respondsToSelector(object$.ref.pointer, _sel_returnsMyProtocol)) {
throw objc.UnimplementedOptionalMethodException(
'SecondaryProtocol',
'returnsMyProtocol',
);
}
final $ret = _objc_msgSend_151sglz(
object$.ref.pointer,
_sel_returnsMyProtocol,
);
return MyProtocol.fromPointer($ret, retain: true, release: true);
}
}
interface class SecondaryProtocol$Builder {
/// Returns the [objc.Protocol] object for this protocol.
static objc.Protocol get $protocol =>
objc.Protocol.fromPointer(_protocol_SecondaryProtocol.cast());
/// Builds an object that implements the SecondaryProtocol 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.
static SecondaryProtocol implement({
required int Function(int, int, int, int) otherMethod_b_c_d_,
Dartinstancetype? Function()? returnsInstanceType,
MyProtocol Function()? returnsMyProtocol,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'SecondaryProtocol');
SecondaryProtocol$Builder.otherMethod_b_c_d_.implement(
builder,
otherMethod_b_c_d_,
);
SecondaryProtocol$Builder.returnsInstanceType.implement(
builder,
returnsInstanceType,
);
SecondaryProtocol$Builder.returnsMyProtocol.implement(
builder,
returnsMyProtocol,
);
builder.addProtocol($protocol);
return SecondaryProtocol.as(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}
/// Adds the implementation of the SecondaryProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder].
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilder(
objc.ObjCProtocolBuilder builder, {
required int Function(int, int, int, int) otherMethod_b_c_d_,
Dartinstancetype? Function()? returnsInstanceType,
MyProtocol Function()? returnsMyProtocol,
bool $keepIsolateAlive = true,
}) {
SecondaryProtocol$Builder.otherMethod_b_c_d_.implement(
builder,
otherMethod_b_c_d_,
);
SecondaryProtocol$Builder.returnsInstanceType.implement(
builder,
returnsInstanceType,
);
SecondaryProtocol$Builder.returnsMyProtocol.implement(
builder,
returnsMyProtocol,
);
builder.addProtocol($protocol);
}
/// otherMethod:b:c:d:
static final otherMethod_b_c_d_ =
objc.ObjCProtocolMethod<int Function(int, int, int, int)>(
_protocol_SecondaryProtocol,
_sel_otherMethod_b_c_d_,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>
>(_13hhotk_protocolTrampoline_ct0ie0)
.cast(),
objc.getProtocolMethodSignature(
_protocol_SecondaryProtocol,
_sel_otherMethod_b_c_d_,
isRequired: true,
isInstanceMethod: true,
),
(int Function(int, int, int, int) func) =>
ObjCBlock_Int32_ffiVoid_Int32_Int32_Int32_Int32.fromFunction(
(
ffi.Pointer<ffi.Void> _,
int arg1,
int arg2,
int arg3,
int arg4,
) => func(arg1, arg2, arg3, arg4),
),
);
/// returnsInstanceType
static final returnsInstanceType =
objc.ObjCProtocolMethod<Dartinstancetype? Function()>(
_protocol_SecondaryProtocol,
_sel_returnsInstanceType,
ffi.Native.addressOf<
ffi.NativeFunction<
instancetype Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
)
>
>(_13hhotk_protocolTrampoline_1mbt9g9)
.cast(),
objc.getProtocolMethodSignature(
_protocol_SecondaryProtocol,
_sel_returnsInstanceType,
isRequired: false,
isInstanceMethod: true,
),
(Dartinstancetype? Function() func) =>
ObjCBlock_instancetype_ffiVoid.fromFunction(
(ffi.Pointer<ffi.Void> _) => func(),
),
);
/// returnsMyProtocol
static final returnsMyProtocol =
objc.ObjCProtocolMethod<MyProtocol Function()>(
_protocol_SecondaryProtocol,
_sel_returnsMyProtocol,
ffi.Native.addressOf<
ffi.NativeFunction<
instancetype Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
)
>
>(_13hhotk_protocolTrampoline_1mbt9g9)
.cast(),
objc.getProtocolMethodSignature(
_protocol_SecondaryProtocol,
_sel_returnsMyProtocol,
isRequired: false,
isInstanceMethod: true,
),
(MyProtocol Function() func) =>
ObjCBlock_idMyProtocol_ffiVoid.fromFunction(
(ffi.Pointer<ffi.Void> _) => func(),
),
);
}
final class SomeStruct extends ffi.Struct {
@ffi.Int32()
external int x;
@ffi.Int32()
external int y;
static ffi.Pointer<SomeStruct> $allocate(
ffi.Allocator $allocator, {
required int x,
required int y,
}) => $allocator<SomeStruct>()
..ref.x = x
..ref.y = y;
}
/// WARNING: SuperProtocol is a stub. To generate bindings for this class, include
/// SuperProtocol in your config's objc-protocols list.
///
/// SuperProtocol
extension type SuperProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol, objc.NSObjectProtocol {
/// Constructs a [SuperProtocol] that points to the same underlying object as [other].
SuperProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [SuperProtocol] that wraps the given raw object pointer.
SuperProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
}
/// UnusedProtocol
extension type UnusedProtocol._(objc.ObjCProtocol object$)
implements objc.ObjCProtocol, objc.NSObjectProtocol {
/// Constructs a [UnusedProtocol] that points to the same underlying object as [other].
UnusedProtocol.as(objc.ObjCObject other) : object$ = other;
/// Constructs a [UnusedProtocol] that wraps the given raw object pointer.
UnusedProtocol.fromPointer(
ffi.Pointer<objc.ObjCObjectImpl> other, {
bool retain = false,
bool release = false,
}) : object$ = objc.ObjCProtocol(other, retain: retain, release: release);
/// Returns whether [obj] is an instance of [UnusedProtocol].
static bool conformsTo(objc.ObjCObject obj) {
return _objc_msgSend_e3qsqz(
obj.ref.pointer,
_sel_conformsToProtocol_,
_protocol_UnusedProtocol,
);
}
}
extension UnusedProtocol$Methods on UnusedProtocol {
/// someMethod
int someMethod() {
return _objc_msgSend_1gcq84o(object$.ref.pointer, _sel_someMethod);
}
}
interface class UnusedProtocol$Builder {
/// Returns the [objc.Protocol] object for this protocol.
static objc.Protocol get $protocol =>
objc.Protocol.fromPointer(_protocol_UnusedProtocol.cast());
/// Builds an object that implements the UnusedProtocol 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.
static UnusedProtocol implement({
required int Function() someMethod,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'UnusedProtocol');
UnusedProtocol$Builder.someMethod.implement(builder, someMethod);
builder.addProtocol($protocol);
return UnusedProtocol.as(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}
/// Adds the implementation of the UnusedProtocol protocol to an existing
/// [objc.ObjCProtocolBuilder].
///
/// Note: You cannot call this method after you have called `builder.build`.
static void addToBuilder(
objc.ObjCProtocolBuilder builder, {
required int Function() someMethod,
bool $keepIsolateAlive = true,
}) {
UnusedProtocol$Builder.someMethod.implement(builder, someMethod);
builder.addProtocol($protocol);
}
/// someMethod
static final someMethod = objc.ObjCProtocolMethod<int Function()>(
_protocol_UnusedProtocol,
_sel_someMethod,
ffi.Native.addressOf<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<ffi.Void>,
)
>
>(_13hhotk_protocolTrampoline_1d4mjzg)
.cast(),
objc.getProtocolMethodSignature(
_protocol_UnusedProtocol,
_sel_someMethod,
isRequired: true,
isInstanceMethod: true,
),
(int Function() func) => ObjCBlock_Int32_ffiVoid.fromFunction(
(ffi.Pointer<ffi.Void> _) => func(),
),
);
}
late final _class_ObjCProtocolImpl = objc.getClass("ObjCProtocolImpl");
late final _class_ObjCProtocolImplMissingMethod = objc.getClass(
"ObjCProtocolImplMissingMethod",
);
late final _class_ProtocolConsumer = objc.getClass("ProtocolConsumer");
final _objc_msgSend_151sglz = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
)
>();
final _objc_msgSend_19nvye5 = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Bool Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>
>()
.asFunction<
bool Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>();
final _objc_msgSend_1bqef4y = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Int32,
)
>
>()
.asFunction<
void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
int,
)
>();
final _objc_msgSend_1cwp428 = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.NSZone>,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.NSZone>,
)
>();
final _objc_msgSend_1gcq84o = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
)
>();
final _objc_msgSend_1sotr3r = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>();
final _objc_msgSend_6plvbo = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Double,
)
>
>()
.asFunction<
ffi.Pointer<objc.ObjCObjectImpl> Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
double,
)
>();
final _objc_msgSend_e3qsqz = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Bool Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCProtocolImpl>,
)
>
>()
.asFunction<
bool Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCProtocolImpl>,
)
>();
final _objc_msgSend_fd28sq = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>();
final _objc_msgSend_hv8ra8 = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Int32,
ffi.Int32,
ffi.Int32,
ffi.Int32,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
int,
int,
int,
int,
)
>();
final _objc_msgSend_lacj97 = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Int32 Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
SomeStruct,
)
>
>()
.asFunction<
int Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
SomeStruct,
)
>();
final _objc_msgSend_xtuoz7 = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>
>()
.asFunction<
void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<objc.ObjCObjectImpl>,
)
>();
final _objc_msgSend_yhkuco = objc.msgSendPointer
.cast<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<ffi.Int32>,
)
>
>()
.asFunction<
void Function(
ffi.Pointer<objc.ObjCObjectImpl>,
ffi.Pointer<objc.ObjCSelector>,
ffi.Pointer<ffi.Int32>,
)
>();
late final _protocol_EmptyProtocol = objc.getProtocol("EmptyProtocol");
late final _protocol_MyProtocol = objc.getProtocol("MyProtocol");
late final _protocol_SecondaryProtocol = objc.getProtocol("SecondaryProtocol");
late final _protocol_UnusedProtocol = objc.getProtocol("UnusedProtocol");
late final _sel_alloc = objc.registerName("alloc");
late final _sel_allocWithZone_ = objc.registerName("allocWithZone:");
late final _sel_callBlockingMethodOnRandomThread_ = objc.registerName(
"callBlockingMethodOnRandomThread:",
);
late final _sel_callInstanceMethod_ = objc.registerName("callInstanceMethod:");
late final _sel_callMethodOnRandomThread_ = objc.registerName(
"callMethodOnRandomThread:",
);
late final _sel_callOptionalMethod_ = objc.registerName("callOptionalMethod:");
late final _sel_callOtherMethod_ = objc.registerName("callOtherMethod:");
late final _sel_callTwoMethods_ = objc.registerName("callTwoMethods:");
late final _sel_conformsToProtocol_ = objc.registerName("conformsToProtocol:");
late final _sel_disabledMethod = objc.registerName("disabledMethod");
late final _sel_fooMethod = objc.registerName("fooMethod");
late final _sel_init = objc.registerName("init");
late final _sel_instanceMethod_withDouble_ = objc.registerName(
"instanceMethod:withDouble:",
);
late final _sel_intPtrMethod_ = objc.registerName("intPtrMethod:");
late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:");
late final _sel_new = objc.registerName("new");
late final _sel_optionalClassMethod = objc.registerName("optionalClassMethod");
late final _sel_optionalMethod_ = objc.registerName("optionalMethod:");
late final _sel_otherMethod_b_c_d_ = objc.registerName("otherMethod:b:c:d:");
late final _sel_requiredClassMethod = objc.registerName("requiredClassMethod");
late final _sel_returnsInstanceType = objc.registerName("returnsInstanceType");
late final _sel_returnsMyProtocol = objc.registerName("returnsMyProtocol");
late final _sel_someMethod = objc.registerName("someMethod");
late final _sel_unimplementedOtionalClassMethod = objc.registerName(
"unimplementedOtionalClassMethod",
);
late final _sel_voidMethod_ = objc.registerName("voidMethod:");
typedef instancetype = ffi.Pointer<objc.ObjCObjectImpl>;
typedef Dartinstancetype = objc.ObjCObject;