-
Notifications
You must be signed in to change notification settings - Fork 282
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
Plugins implode upon errors when developing locally #132
Comments
Regarding
I think it is related to what is described here. And for
I cannot reproduce the error described error, on my pc... it dosn't crash.
Using the folowing go.mod
|
I am experiencing this same crash when returning some error from the Go plugin side. I am also using the replace keyword to develop the plugin locally. |
I digged a bit in the source code and I found this in
Shouldn't the last block be in an else statement? If |
@davidmartos96 I think you are right! |
@Drakirus I just created a PR #174 |
I was able to reproduce the error. First of: var result = await platform.invokeMethod("remove", "i am a bad argument"); Will generate a panic since this cast isn't correct.
go-flutter will recover the panic and resume normal execution. I was unable to reproduce the golang error proposed by @drdgvhbh
Thanks to @davidmartos96 this issue was fixed. I should of try to dig a little bit deeper when I looked at the issue (by asking questions). This error was serious, and I didn't realized,.. my bad. |
Ohh, |
@Drakirus I came across this issue while porting a plugin that threw some handled errors from the native side. Returning nil, err wasn't working correctly... |
👍 |
@Drakirus It is |
If you are using |
@Drakirus Yes, I was already using HandleFunc. I found the issue though. I was comparing the performance of the sqlite library on the android emulator vs go-flutter. It looks like the encoding and decoding performance of the platform calls is much worse in go-flutter. 1 INSERT (time since the call to invokeMethod in Dart until the reply is received in Dart) Quite different performance right? The time it takes to make the actual INSERT measured in the native side is 100 us in both platforms. Is this a known limitation of the project? Awesome project BTW :) |
@davidmartos96 thanks for the feedback. I'm pretty sure the 30ms comes from the MainLoop. The flutter engine team added On go-flutter, we could use |
If you try to develop a plugin locally and the method you invoke returns an error, it your application will crash. When to invoke the same plugin that is versioned, you won't crash.
Also interestingly, I am unable to catch errors when invoking platform methods using try/catch.
Flutter version
Plugin version
github.com/go-flutter-desktop/plugins/shared_preferences v0.4.0
Go.mod file
Golang errors (Optional)
Steps to Reproduce
github.com/go-flutter-desktop/plugins/shared_preferences
in yourgo
source foldergithub.com/go-flutter-desktop/plugins/shared_preferences v0.4.0
replace github.com/go-flutter-desktop/plugins/shared_preferences => /home/drd/go/src/github.com/go-flutter-desktop/plugins/shared_preferences
The text was updated successfully, but these errors were encountered: