Open mkustermann opened 2 years ago
A wrote a small doc explaining why this important and how it might work.
Here is a possible way to do that: https://gist.github.com/mraleph/5971f1904d474526066dc3c792c9436e, just leaving it here for completeness.
I think macros can be a good way to cut on the boilerplate and do a lot of this in pure Dart.
There's use cases where it would be very convenient to make subclasses of ObjC classes (e.g. see sub-classing NSOperationQueue) and doing so in Dart.
Having this ability would avoid the need to write native code (and thereby not require changes to
dart:ffi
or adding flutter-specific plugins) - it could be done purely in Dart .The most convenient way would be have Dart syntax for making subclasses of ObjC, possibly with some language restrictions and kernel lowering - similar to how the pure C-based FFI support is done.
Though a simpler way to get started would be providing utilities to procedurally lookup classes, create classes, add methods, ... (see objc_allocateClassPair, objc_addmethod)
/cc @brianquinlan @mraleph @dcharkes