go icon indicating copy to clipboard operation
go copied to clipboard

gomobile

Open ghost opened this issue 6 years ago • 3 comments

I use FLutter, and instead of using the Emitter Dart client lib, its also possible to use the go client lib by compilng golang with gomobile. Then its really easy to embed the gomobile lib inside Flutter. You can even use event streams.

I am raising this because its another way to get the same thing done and has some advantages:

  • reduces code maintenance
  • Using golang for the networking on both sides makes the whole thing more sturdy and when you fix a bug your fixing it on both sides.
  • Flutter Plugins for GO-Desktop work exactly the same on Mobile as on Desktop. SO you can use it for Desktop too.
  • Flutter Web can also use it by using gowasm.

Of course there are some bad things too:

  • More overhead because you have to pass through more layers, but for GUI its a minor hit and GUI is not where the bottleneck is.
  • More complexity for sure.

ghost avatar May 26 '19 07:05 ghost

@gedw99 could you submit a PR with this approach? Are you using gopherjs or building go down to wasm?

kelindar avatar Jun 29 '19 11:06 kelindar

Hey

I just use gomobile. Not gopherjs or wasm.

There are a ton of examples and I am on the road right now.

Google "flutter gomobile" and you will find complete examples I promise.

If you need help yell and I can help when back home in 4 days :)

ghost avatar Jun 29 '19 11:06 ghost

https://github.com/adieu/flutter_go

Using JSON as the serialisation solves the FFI issues.

Also dart has FFI in beta. Its too early to use it but others are. Then you can compile the golang as a c shared lib and call it from flutter..I will change to this approach in a month once dart FFI settles down.

ghost avatar Jun 29 '19 11:06 ghost