observeValue property

void Function(NSObject pigeon_instance, String? keyPath, NSObject? object, Map<KeyValueChangeKey, Object?>? change)? observeValue
finalinherited

Informs the observing object when the value at the specified key path relative to the observed object has changed.

For the associated Native object to be automatically garbage collected, it is required that the implementation of this Function doesn't have a strong reference to the encapsulating class instance. When this Function references a non-local variable, it is strongly recommended to access it with a WeakReference:

final WeakReference weakMyVariable = WeakReference(myVariable);
final NSObject instance = NSObject(
 observeValue: (NSObject pigeon_instance, ...) {
   print(weakMyVariable?.target);
 },
);

Alternatively, PigeonInstanceManager.removeWeakReference can be used to release the associated Native object manually.

Implementation

final void Function(
  NSObject pigeon_instance,
  String? keyPath,
  NSObject? object,
  Map<KeyValueChangeKey, Object?>? change,
)? observeValue;