| // AUTO GENERATED FILE, DO NOT EDIT. |
| // |
| // Generated by `package:ffigen`. |
| // ignore_for_file: type=lint, unused_import, unused_element, deprecated_member_use_from_same_package |
| @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; |
| |
| const _$objcVersionCheck = objc.ObjCVersionCheck(9, 6); |
| @ffi.Native< |
| ffi.Pointer<objc.ObjCBlockImpl> Function( |
| ffi.Int64, |
| ffi.Pointer<objc.DOBJC_Context>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function(ffi.Pointer<objc.ObjCObjectImpl> args) |
| > |
| >, |
| ) |
| >(isLeaf: true) |
| external ffi.Pointer<objc.ObjCBlockImpl> _rdx59v_wrapBlockingBlock_1bqef4y( |
| int port, |
| ffi.Pointer<objc.DOBJC_Context> context, |
| ffi.Pointer< |
| ffi.NativeFunction<ffi.Void Function(ffi.Pointer<objc.ObjCObjectImpl> args)> |
| > |
| directInvoke, |
| ); |
| |
| @ffi.Native< |
| ffi.Pointer<objc.ObjCBlockImpl> Function( |
| ffi.Int64, |
| ffi.Pointer<objc.DOBJC_Context>, |
| ) |
| >(isLeaf: true) |
| external ffi.Pointer<objc.ObjCBlockImpl> _rdx59v_wrapListenerBlock_1bqef4y( |
| int port, |
| ffi.Pointer<objc.DOBJC_Context> context, |
| ); |
| |
| /// Construction methods for `objc.ObjCBlock<ffi.Void Function(ffi.Int32)>`. |
| abstract final class ObjCBlock_ffiVoid_Int32 { |
| /// Returns a block that wraps the given raw block pointer. |
| static objc.ObjCBlock<ffi.Void Function(ffi.Int32)> fromPointer( |
| ffi.Pointer<objc.ObjCBlockImpl> pointer, { |
| bool retain = false, |
| bool release = false, |
| }) => objc.ObjCBlock<ffi.Void Function(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.Int32)> fromFunctionPointer( |
| ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Int32 arg0)>> ptr, |
| ) => objc.ObjCBlock<ffi.Void Function(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.Int32)> fromFunction( |
| void Function(int) fn, { |
| bool keepIsolateAlive = true, |
| }) => objc.ObjCBlock<ffi.Void Function(ffi.Int32)>( |
| objc.newClosureBlock(_closureCallable, (int arg0) { |
| return fn(arg0); |
| }, keepIsolateAlive), |
| retain: false, |
| release: true, |
| ); |
| |
| /// Creates a listener block from a Dart function. |
| /// |
| /// This block can be invoked from any thread, but only supports void |
| /// functions, and is not run synchronously. Async functions (ie returning |
| /// Future<void>) are not supported. |
| /// |
| /// 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.Int32)> listener( |
| void Function(int) fn, { |
| bool keepIsolateAlive = true, |
| }) { |
| return objc.ObjCBlock<ffi.Void Function(ffi.Int32)>( |
| objc.newBlockPort(_rdx59v_wrapListenerBlock_1bqef4y, ( |
| ffi.Pointer<objc.ObjCObjectImpl> rawArgs, |
| ) { |
| final args = _BlockArgs_1liq3c0.fromPointer( |
| rawArgs, |
| retain: false, |
| release: false, |
| ); |
| |
| fn(args.arg0); |
| }, keepIsolateAlive), |
| 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 (ie returning Future<void>) 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.Int32)> blocking( |
| void Function(int) fn, { |
| bool keepIsolateAlive = true, |
| }) { |
| return objc.ObjCBlock<ffi.Void Function(ffi.Int32)>( |
| objc.newBlockingBlockPort(_rdx59v_wrapBlockingBlock_1bqef4y, ( |
| ffi.Pointer<objc.ObjCObjectImpl> rawArgs, |
| ) { |
| final args = _BlockArgs_1liq3c0.fromPointer( |
| rawArgs, |
| retain: false, |
| release: false, |
| ); |
| |
| fn(args.arg0); |
| }, keepIsolateAlive), |
| retain: false, |
| release: true, |
| ); |
| } |
| |
| static void _fnPtrTrampoline( |
| ffi.Pointer<objc.ObjCBlockImpl> block, |
| int arg0, |
| ) => block.ref.target |
| .cast<ffi.NativeFunction<ffi.Void Function(ffi.Int32 arg0)>>() |
| .asFunction<void Function(int)>()(arg0); |
| static ffi.Pointer<ffi.Void> _fnPtrCallable = |
| ffi.Pointer.fromFunction< |
| ffi.Void Function(ffi.Pointer<objc.ObjCBlockImpl>, ffi.Int32) |
| >(_fnPtrTrampoline) |
| .cast(); |
| static void _closureTrampoline( |
| ffi.Pointer<objc.ObjCBlockImpl> block, |
| int arg0, |
| ) => (objc.getBlockClosure(block) as void Function(int))(arg0); |
| static ffi.Pointer<ffi.Void> _closureCallable = |
| ffi.Pointer.fromFunction< |
| ffi.Void Function(ffi.Pointer<objc.ObjCBlockImpl>, ffi.Int32) |
| >(_closureTrampoline) |
| .cast(); |
| } |
| |
| /// Call operator for `objc.ObjCBlock<ffi.Void Function(ffi.Int32)>`. |
| extension ObjCBlock_ffiVoid_Int32$CallExtension |
| on objc.ObjCBlock<ffi.Void Function(ffi.Int32)> { |
| void call(int arg0) { |
| return ref.pointer.ref.invoke |
| .cast< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<objc.ObjCBlockImpl> block, |
| ffi.Int32 arg0, |
| ) |
| > |
| >() |
| .asFunction<void Function(ffi.Pointer<objc.ObjCBlockImpl>, int)>()( |
| ref.pointer, |
| arg0, |
| ); |
| } |
| } |
| |
| /// Sendable |
| extension type Sendable._(objc.ObjCObject object$) |
| implements objc.ObjCObject, objc.NSObject { |
| /// Constructs a [Sendable] that points to the same underlying object as [other]. |
| Sendable.as(objc.ObjCObject other) : object$ = other { |
| assert(isA(object$)); |
| } |
| |
| /// Constructs a [Sendable] that wraps the given raw object pointer. |
| Sendable.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 [Sendable]. |
| static bool isA(objc.ObjCObject? obj) => obj == null |
| ? false |
| : _objc_msgSend_19nvye5( |
| obj.ref.pointer, |
| _sel_isKindOfClass_, |
| _class_Sendable, |
| ); |
| |
| /// alloc |
| static Sendable alloc() { |
| final $ret = _objc_msgSend_151sglz(_class_Sendable, _sel_alloc); |
| return Sendable.fromPointer($ret, retain: false, release: true); |
| } |
| |
| /// allocWithZone: |
| static Sendable allocWithZone(ffi.Pointer<objc.NSZone> zone) { |
| final $ret = _objc_msgSend_1cwp428( |
| _class_Sendable, |
| _sel_allocWithZone_, |
| zone, |
| ); |
| return Sendable.fromPointer($ret, retain: false, release: true); |
| } |
| |
| /// dummyMethodToForceGenerationOfListener |
| static objc.ObjCBlock<ffi.Void Function(ffi.Int32)> |
| dummyMethodToForceGenerationOfListener() { |
| final $ret = _objc_msgSend_uwvaik( |
| _class_Sendable, |
| _sel_dummyMethodToForceGenerationOfListener, |
| ); |
| return ObjCBlock_ffiVoid_Int32.fromPointer( |
| $ret, |
| retain: true, |
| release: true, |
| ); |
| } |
| |
| /// new |
| static Sendable new$() { |
| final $ret = _objc_msgSend_151sglz(_class_Sendable, _sel_new); |
| return Sendable.fromPointer($ret, retain: false, release: true); |
| } |
| |
| /// Returns a new instance of Sendable constructed with the default `new` method. |
| Sendable() : this.as(new$().object$); |
| } |
| |
| extension Sendable$Methods on Sendable { |
| /// init |
| Sendable init() { |
| final _$$ref = object$.ref; |
| objc.checkOsVersionInternal( |
| 'Sendable.init', |
| iOS: (false, (2, 0, 0)), |
| macOS: (false, (10, 0, 0)), |
| ); |
| final $ret = _objc_msgSend_151sglz( |
| _$$ref.retainAndReturnPointer(), |
| _sel_init, |
| ); |
| return Sendable.fromPointer($ret, retain: false, release: true); |
| } |
| |
| /// setValue: |
| set value(int value) { |
| final _$$ref = object$.ref; |
| _objc_msgSend_1bqef4y(_$$ref.pointer, _sel_setValue_, value); |
| } |
| |
| /// value |
| int get value { |
| final _$$ref = object$.ref; |
| return _objc_msgSend_1gcq84o(_$$ref.pointer, _sel_value); |
| } |
| } |
| |
| extension type _BlockArgs_1liq3c0._(objc.ObjCObject object$) |
| implements objc.ObjCObject { |
| /// Constructs a [_BlockArgs_1liq3c0] that points to the same underlying object as [other]. |
| _BlockArgs_1liq3c0.as(objc.ObjCObject other) : object$ = other { |
| assert(isA(object$)); |
| } |
| |
| /// Constructs a [_BlockArgs_1liq3c0] that wraps the given raw object pointer. |
| _BlockArgs_1liq3c0.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 [_BlockArgs_1liq3c0]. |
| static bool isA(objc.ObjCObject? obj) => obj == null |
| ? false |
| : _objc_msgSend_19nvye5( |
| obj.ref.pointer, |
| _sel_isKindOfClass_, |
| _class__BlockArgs_1liq3c0, |
| ); |
| } |
| |
| extension _BlockArgs_1liq3c0$Methods on _BlockArgs_1liq3c0 { |
| int get arg0 { |
| final _$$ref = object$.ref; |
| return _objc_msgSend_1gcq84o(_$$ref.pointer, _sel_arg0); |
| } |
| } |
| |
| @ffi.Native<ffi.Pointer<objc.ObjCObjectImpl>>(symbol: 'OBJC_CLASS_\$_Sendable') |
| external ffi.Pointer<objc.ObjCObjectImpl> _class_Sendable_raw; |
| final _class_Sendable = objc.getClass( |
| "Sendable", |
| () => ffi.Native.addressOf<ffi.Pointer<objc.ObjCObjectImpl>>( |
| _class_Sendable_raw, |
| ).cast(), |
| ); |
| @ffi.Native<ffi.Pointer<objc.ObjCObjectImpl>>( |
| symbol: 'OBJC_CLASS_\$__rdx59v_BlockArgs_1bqef4y', |
| ) |
| external ffi.Pointer<objc.ObjCObjectImpl> _class__BlockArgs_1liq3c0_raw; |
| final _class__BlockArgs_1liq3c0 = objc.getClass( |
| "_rdx59v_BlockArgs_1bqef4y", |
| () => ffi.Native.addressOf<ffi.Pointer<objc.ObjCObjectImpl>>( |
| _class__BlockArgs_1liq3c0_raw, |
| ).cast(), |
| ); |
| 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_uwvaik = objc.msgSendPointer |
| .cast< |
| ffi.NativeFunction< |
| ffi.Pointer<objc.ObjCBlockImpl> Function( |
| ffi.Pointer<objc.ObjCObjectImpl>, |
| ffi.Pointer<objc.ObjCSelector>, |
| ) |
| > |
| >() |
| .asFunction< |
| ffi.Pointer<objc.ObjCBlockImpl> Function( |
| ffi.Pointer<objc.ObjCObjectImpl>, |
| ffi.Pointer<objc.ObjCSelector>, |
| ) |
| >(); |
| late final _sel_alloc = objc.registerName("alloc"); |
| late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); |
| late final _sel_arg0 = objc.registerName("arg0"); |
| late final _sel_dummyMethodToForceGenerationOfListener = objc.registerName( |
| "dummyMethodToForceGenerationOfListener", |
| ); |
| late final _sel_init = objc.registerName("init"); |
| late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); |
| late final _sel_new = objc.registerName("new"); |
| late final _sel_setValue_ = objc.registerName("setValue:"); |
| late final _sel_value = objc.registerName("value"); |
| typedef instancetype = ffi.Pointer<objc.ObjCObjectImpl>; |
| typedef Dartinstancetype = objc.ObjCObject; |