objective_c 1.0.1 copy "objective_c: ^1.0.1" to clipboard
objective_c: ^1.0.1 copied to clipboard

PlatformiOSmacOS

A library to access Objective C from Flutter that acts as a support library for package:ffigen.

Build Status Coverage Status pub package package publisher

objective_c #

A library to access Objective C from Flutter that acts as a support library for package:ffigen.

This library isn't very useful on its own. Typically it is used while interoperating with an Objective C library created by package:ffigen. See https://pub.dev/packages/ffigen

For general information about interop with Objective C, see https://dart.dev/guides/libraries/objective-c-interop

Status: Experimental #

NOTE: This package is currently experimental and published under the labs.dart.dev pub publisher in order to solicit feedback.

For packages in the labs.dart.dev publisher we generally plan to either graduate the package into a supported publisher (dart.dev, tools.dart.dev) after a period of feedback and iteration, or discontinue the package. These packages have a much higher expected rate of API and breaking changes.

Your feedback is valuable and will help us evolve this package. For bugs or suggestions, please file an issue in the bug tracker.

Memory management #

Objective C and Dart use different styles of memory management. Dart is garbage collected, while Objective C uses reference counting. This difference is a common cause of bugs when interoperating between the two languages.

Memory management issues typically manifest as seg faults, which can be hard to debug as they often have no useful stack trace. The most common issue is use after free errors, where a Dart object is constructed to wrap an Objective C object that has already been destroyed. To debug these issues, try running your program with asserts enabled. When the Dart wrapper object is created or destroyed, an assert checks that the Objective C object still exists, which should provide a much more useful stack trace.

References are automatically retained when the Dart wrapper object is created, and released when the Dart object is garbage collected. But to fix a reference counting issue, it may occasionally be necessary to manually control the ref count. The ref count of the Objective C object can be controlled from Dart by the retain and release options in the Dart wrapper object constructors, and by the retainAndReturnPointer() and release() methods.

1
likes
130
pub points
28%
popularity

Publisher

verified publisherlabs.dart.dev

A library to access Objective C from Flutter that acts as a support library for package:ffigen.

Repository (GitHub)
View/report issues
Contributing

Topics

#interop #ffi #objective-c #codegen

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

ffi, flutter, plugin_platform_interface, yaml

More

Packages that depend on objective_c