objective_c
9.6.4, released 9 days ago by dart.dev
Support library for accessing Objective C via ffigen in Flutter
What it does
Provides Dart wrappers and utilities for Objective C objects, handling memory management and stream conversion. It is intended to be used alongside ffigen-generated bindings.
AI-written summary of version 9.6.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to call Objective C APIs from Flutter
- You are using ffigen to generate bindings for an Objective C library
- You require efficient stream handling and memory safety for Objective C objects
Skip it when
- You are not using ffigen or any Objective C code
- You need a pure Dart solution for your platform
Strengths
- Integrates tightly with ffigen
- Offers memory‑management helpers (retain/release)
- Performance improvements for stream and data conversion
Weaknesses
- Not useful on its own
- Limited to platforms that support Objective C (iOS, macOS, Windows, Linux, Android)
- Requires native build steps
Setup
- Kind
- FFI (native library)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
// Example usage with ffigen-generated bindings
import 'package:ffigen/ffigen.dart';
import 'package:objective_c/objective_c.dart';
final obj = MyObj();
final nsString = obj.toNSString();
print(nsString);Alternatives
Packages that do the same job and could replace objective_c.
- ffigen
Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.
90Compare - jnigen
A Dart bindings generator for Java and Kotlin APIs using JNI and dart:ffi.
87Compare - pigeon
Type-safe code generator for communication between Flutter and host platforms.
90Compare - native_toolchain_c
Invoke the native C compiler installed on the host machine.
85Compare
Works with
Packages commonly used together with objective_c: ones it builds on, ones built on it, and its own family.
- pub_semverobjective_c depends on itVersions and version constraints implementing pub's versioning policy.
- hooksobjective_c depends on itDart API for the JSON-based protocol for package build and link hooks.
- code_assetsobjective_c depends on itProvides the hook protocol specification for bundling native code with Dart packages.
- ffiobjective_c depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- loggingobjective_c depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- built_valueSame familyImmutable value types with builders, enum classes and JSON serialization for Dart.
- platformSame familyCross‑platform abstraction for querying runtime platform info in Dart.
- asyncSame familyUtility classes and helpers that extend Dart's async library.