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

Mutliple arguments when Ack #21

Closed
Oskang09 opened this issue May 14, 2019 · 2 comments
Closed

Mutliple arguments when Ack #21

Oskang09 opened this issue May 14, 2019 · 2 comments

Comments

@Oskang09
Copy link
Contributor

Trying to get work with featherjs and unable to work with the direct connection given at documentation.

Worked well after make this fix.
( L150, lib/src/socket.dart )

// But would break other data type
List sendData = data === null ? [event] : [event, ...data];

Example code:

_socket.emitWithAck('get', [ 'product', 78 ],
            ack: (error, data) {
                print(error);
            });
_socket.emitWIthAck('find', [ 'product' ], 
            ack: (error, data) {
                print(error);
            });

And also for arguments when success feathers only return error & data, when error only receive error and dart would throw error.

Error Message:

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: Closure call with mismatched arguments: function 'call'
@jumperchen
Copy link
Member

FYI: Spread operator only works on Dart 2.3, but our internal project still works with Dart 2.1.

@Oskang09
Copy link
Contributor Author

Oskang09 commented May 14, 2019

I think this work too for concat values for lower than dart 2.3

[].add(event)..addAll(data)

EDIT :

Fixed all issues that i have meet. Thanks for your helping too.

For emiting part:

      List sendData = [event];
      if (data is Iterable) {
          sendData.addAll(data);
      } else if (data != null) {
          sendData.add(data);
      }

For ack part:

           ack: (Map error, [ Map data ]) {
                print(error);
                print(data);
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants