-
Notifications
You must be signed in to change notification settings - Fork 40
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
Dart 2 support #13
Comments
Hi there. I think that the code should work as-is with dart2. In fact, I just tried running the test suite against |
Hey, Using Flutter/Dart from flutter master channel, Dart version 2.0.0-dev.60.0.flutter-a5e41681e5
Using Flutter/Dart from beta channel, Dart version 2.0.0-dev.54.0.flutter-46ab040e58
Code:
Using
|
I've found this thread regarding --preview-dart-2
|
Thanks for bringing this to my attention. I think I know why the compiler complains. I will run everything through dartalyzer and push an updated package later today. |
In the meantime you can try applying this fix manually to your local package: diff --git a/lib/src/client/impl/channel_impl.dart b/lib/src/client/impl/channel_impl.dart
index 9686c1f..f9b4c47 100644
--- a/lib/src/client/impl/channel_impl.dart
+++ b/lib/src/client/impl/channel_impl.dart
@@ -410,11 +410,11 @@ class _ChannelImpl implements Channel {
}
/**
- * Close the channel and return a [Future] to be completed when the channel is closed.
+ * Close the channel and return a [Future<Channel>] to be completed when the channel is closed.
*
* After closing the channel any attempt to send a message over it will cause a [StateError]
*/
- Future close() => _close(replyCode : ErrorType.SUCCESS, replyText : "Normal shutdown");
+ Future<Channel> close() => _close(replyCode : ErrorType.SUCCESS, replyText : "Normal shutdown"); |
@achilleasa, thanks for your efforts I ran dartanalyzer command with
|
Hey, I made some changes on my forked repo and it's working nicely, for now. |
Ah, thanks for figuring out a fix. I totally missed that as I am not currently using Flutter. Are your changes (Endian, JSON and UTF8) backwards compatible with dart 1.x? Actually, I could merge #14 which has some dartanalyzer fixes (and also updates .travis.yaml to run dartanalyzer) and you can open a new PR with your additional fixes (also update .travis.yaml to run with |
So, I didn't test with dart 1.x yet. Even dart-analyzer was complaining about Endian, JSON and UTF8, I think these changes are not necessary, actually. I will test it again using only < TYPE > changes., which I believe should be backward compatible with dart 1.x, right? |
I just merged #14 which fixes the type errors reported by dartanalyzer (but not the ones reported when running with |
I can confirm with the #15 that only these changes are enough to run dart_amqp with current flutter SDK, either using beta or master channel. I don't have enough experience with the dart language to decide what is better about other changes. 👍 Many thanks, this plugin is going to be a key to achieve the success of our project in our company. |
I have merged #15 and pushed an updated package so I am closing this issue. Thanks for your PR and please do open more issues if you encounter other dart2 compatibility issues in the future. |
Hey there,
Are there any expectations to convert the code for dart2? Or to have a specific branch of it.
I've tested it with Flutter (Dart 1) and RabbitMQ and it's working nicely. But I do think to use dart2 instead.
I would like to help if possible.
Cheers,
The text was updated successfully, but these errors were encountered: