Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objective-C blocks should use the generated Dart class rather than ffi.Pointer<ObjCObject> #473

Closed
brianquinlan opened this issue Mar 8, 2023 · 0 comments · Fixed by dart-archive/ffigen#632
Labels
lang-objective_c Related to Objective C support package:ffigen type-enhancement A request for a change that isn't a bug

Comments

@brianquinlan
Copy link
Contributor

Currently a method like:

- (void)readDataOfMinLength:(NSUInteger)minBytes 
                  maxLength:(NSUInteger)maxBytes 
                    timeout:(NSTimeInterval)timeout 
          completionHandler:(void (^)(NSData *data, BOOL atEOF, NSError *error))completionHandler;

Will generate a block like:

class ObjCBlock40 extends _ObjCBlockBase {
...
  void call(
      ffi.Pointer<ObjCObject> arg0, bool arg1, ffi.Pointer<ObjCObject> arg2) {
...

Instead, call should have a signature like:

class ObjCBlock40 extends _ObjCBlockBase {
...
  void call(
      NSData data, bool atEOF, NSError error) {
...

Using the correct argument names is for bonus points ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-objective_c Related to Objective C support package:ffigen type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants