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

PlatformiOSmacOS

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

4.0.0 #

  • Use ffigen 16.0.0
  • Add NSOrderedCollectionDifference to the package.
  • Breaking change: As part of ffigen 16.0.0, the way ObjC categories are generated has changed. Instead of inserting their methods into the interface, categories now generate Dart extension methods. For ordinary methods this makes no difference, but static methods now need to be invoked on the extension instead of on the class. MyInterface.staticMethod must change to MyCategory.staticMethod
  • Breaking change`: Another effect of the category overhaul is that we don't automatically included all categories any more. This reduces the ammount of bindings generated by omitting methods from obscure categories that most users don't need. If you notice that a method you were using is now missing, there are two options:
    1. Look up which category it came from in the Apple documentation, and generate bindings for that category yourself in your own package.
    2. If the category is common/important enough that it should be included in package:objective_c, file a bug and we'll consider adding it back in.
  • Fixed a bug where missing methods could cause runtime errors, even if they weren't being implemented.
  • Throw more useful errors in all internal failure cases.
  • Added ObjCProtocolMethod.isAvailable getter, to make it easier to implement fallback logic if a method is missing at runtime.

3.0.0 #

  • Add the following stream-related types to the core package:
    • NSInputStream
    • NSOutputStream
    • NSRunLoop
    • NSStream
    • NSStreamDelegate
    • NSStreamEvent
    • NSStreamStatus
  • Add UnimplementedOptionalMethodException, which is thrown by the ObjC bindings if an optional method is invoked, and the instance doesn't implement the method.
  • Dispatch all object/block releases to the main thread.
  • Add utils for converting Dart Strings to Objective-C selectors and back.
  • Require Dart 3.4 or later (due to the use of dart:ffi Struct.create by package:ffigen).
  • Breaking change: Return structs from ObjC methods by value instead of taking a struct return pointer.

2.0.0 #

  • Drop API methods that are deprecated in the oldest versions of iOS and macOS that flutter supports.
  • Added ObjCBlock, which is the new user-facing representation of ObjC blocks.
  • Migrate to ARC (Automatic Reference Counting).
  • Enable ObjC objects and blocks to be sent between isolates.
  • Add autorelease and retainAndAutorelease methods to ObjC objects and blocks.
  • Breaking change: Remove some convenience methods from _ObjCRefHolder: isReleased, release, pointer, and retainAndReturnPointer. Uses of these methods now need to go through .ref. Eg obj.pointer becomes obj.ref.pointer.

1.1.0 #

  • Add DartProxy, which is an implementation of NSProxy that enables implementing ObjC protocols from Dart. Also adds DartProxyBuilder for constructing DartProxy.
  • Add some extensions methods for NSMutableData.
  • Fix the NSError bindings so that they're not empty.
  • Add ObjCProtocolBuilder, which is an ergonomic wrapper around DartProxyBuilder.
  • Add ObjCProtocolMethod, which contains all the information that ObjCProtocolBuilder needs to implement a method. These objects are created by the ffigen bindings for a protocol.
  • Make all of the code-genned structs and enums public so they can be reused by user bindings.
  • Use package:dart_flutter_team_lints.

1.0.1 #

  • Mention experimental status in readme.

1.0.0 #

  • Move sharable code from ffigen's generated code into this package, including ObjCObjectBase, and ObjCBlockBase, as well as the core Objective C runtime functions (except objc_msgSend, which is library specific).
  • Move core ObjC classes such as NSString into this package.
  • Delete Dart functions associated with ObjC closure blocks when the block is destroyed. Fixes https://github.com/dart-lang/native/issues/204
  • Improve debuggability of memory management errors.
2
likes
160
pub points
69%
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

More

Packages that depend on objective_c