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

Could you write a similar article on how to use Golang and Flutter together for desktop? #9

Closed
ganeshrvel opened this issue Jul 23, 2020 · 1 comment

Comments

@ganeshrvel
Copy link

I have been trying to setup a project to use Flutter and Golang together for macOS.

I followed two of your articles https://medium.com/stack-me-up/meet-the-coolest-tech-marriage-flutter-go-369cf11367c9 and https://medium.com/flutter-community/using-ffi-on-flutter-plugins-to-run-native-rust-code-d64c0f14f9c2 but unfortunately I could not get the setup happen.

I got lost at macOS bundle security and dylib linking using xcode.

How do I expose the golang native functions into flutter app for desktop?
Could you write a similar article on how to use Golang and Flutter together for desktop or any pointers will be appreciated.

@brickpop
Copy link
Owner

brickpop commented Sep 6, 2020

Hi ganeshrvel,

I'm glad you followed the other article. Unfortunately, I'm not sure at which point you get stuck.

I got lost at macOS bundle security and dylib linking using xcode.

What step do you mean by bundle security? Go mobile will generate a .framework file for iOS, which contains the binary libraries and all the glue code already working for you.

You need to either (1) drag it into your XCode project (manual setup) or (2) tell Cocoa Pods to add MyLibrary.framework for you within the plugin. Linking and bundling will happen when you compile the final flutter app.

Exposing the raw native go functions as we do in Rust is not really an option. I have been exploring what gomobileand gobind do under the hood, and it look like there is no way around the extra Go glue code, and Java/Swift glue code as well.

I have tried compiling with GOOS and GOARCH but this won't simply do the trick. At the moment, go mobile, seems the way to go. If I find a better way, I'll follow up with the article and probably prepare an equivalent repo.

@brickpop brickpop closed this as completed Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants