Flutter and golang

2,208 views
Skip to first unread message

Ged Wed

unread,
Mar 10, 2018, 3:28:19 PM3/10/18
to golang-nuts
I am starting to develop an app using flutter and golang.

Flutter is the dumb GUI and everything else is written in golang.

It is reasonably easy to compile your golang code using gomobile and then bind to flutter using the Method Channel API that flutter provides.

Is anyone interested in this ?

Flutter now runs on all desktops and mobiles officially. The desktop version was announced 2 weeks ago and already Linux and macOS works, with Windows probably being a few weeks away from what I guesstimate.

The cool thing about this is that you get a very well supported and high performance GUI engine for Forms and 2D. 3D is still not provided by has been stated by the team to be looked at later.

Anyway I hope to spark some interest in this and I will be putting up some demo code on my git hub repo and hope others are interested enough to also give it a try and work through it.


How to write a plug-in:

https://flutter.io/platform-channels/

Plugins already available :

https://pub.dartlang.org/flutter/packages

Printing.
They have not yet officially committed to how cross platform out put to PDF and XPS ( for windows ) will be supported.
Under the covers Flutter is using the same engine that Google Chrome browser uses; called Skia.

Skia has an API for printing web pages and it uses pdfium under the hood.
It seams logical that the Flutter team will also start using this method to provide built in PDF output and even print spooling but from what I can see it's not resolved yet.

All other things like touch, keyboard, sound, gestures etc are all built into Flutter because it's built into Skia.

Would be great to hear if there is a strong interest in this and to discuss .

Ged Wed

unread,
Mar 10, 2018, 3:32:19 PM3/10/18
to golang-nuts

Ged Wed

unread,
Mar 10, 2018, 3:36:42 PM3/10/18
to golang-nuts
https://github.com/flutter/flutter/issues/14231

It looks like it's doable and there is a bug to fix so that flutter can bind directly to flutter without having to go via a Java or Objective-c layer.

Justin Israel

unread,
Mar 10, 2018, 4:17:13 PM3/10/18
to Ged Wed, golang-nuts


On Sun, Mar 11, 2018, 9:28 AM Ged Wed <ged...@gmail.com> wrote:
I am starting to develop an app using flutter and golang.

Flutter is the dumb GUI and everything else is written in golang.

It is reasonably easy to compile your golang code using gomobile and then bind to flutter using the Method Channel API that flutter provides.

Is anyone interested in this ?

I was just recently considering getting some mobile dev practice in, and was thinking whether to use a flutter approach or something with Qt and gomobile. I would be very interested in reading a write up of your experience getting started with Flutter + gomobile 


Flutter now runs on all desktops and mobiles officially. The desktop version was announced 2 weeks ago and already Linux and macOS works, with Windows probably being a few weeks away from what I guesstimate.

The cool thing about this is that you get a very well supported and high performance GUI engine for Forms and 2D. 3D is still not provided by has been stated by the team to be looked at later.

Anyway I hope to spark some interest in this and I will be putting up some demo code on my git hub repo and hope others are interested enough to also give it a try and work through it.


How to write a plug-in:

https://flutter.io/platform-channels/

Plugins already available :

https://pub.dartlang.org/flutter/packages

Printing.
They have not yet officially committed to how cross platform out put to PDF and XPS ( for windows ) will be supported.
Under the covers Flutter is using the same engine that Google Chrome browser uses; called Skia.

Skia has an API for printing web pages and it uses pdfium under the hood.
It seams logical that the Flutter team will also start using this method to provide built in PDF output and even print spooling but from what I can see it's not resolved yet.

All other things like touch, keyboard, sound, gestures etc are all built into Flutter because it's built into Skia.

Would be great to hear if there is a strong interest in this and to discuss .

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ged Wed

unread,
Mar 10, 2018, 4:36:35 PM3/10/18
to Justin Israel, golang-nuts
I used QT for 6 months and Flutter is way ahead.
QT has a huge licensing issue. You can only use QT and not pay a yearly fee of 3 k if you provide the ability for end users to recompile your app against QT.
Also it's got a lot of rough edges once you get into the 80/20 situation on real world apps.
It takes 20% of your time to get 80% of your app done, and 80% of your time to get the last 20% of your app done.
Flutters plug-in system avoids you getting cornered in the 80/20 situation.

I started to do an integration of botldb and some other golang code but am half way through. From what I can see there are no roadblocks. There is one issue with APK packing but I think it just need a script to fix it.
I have not published on GitHub yet because it's not done but will..gedw99 is my GitHub org 

There is a repo there called CI where I am also getting continuous build going for flutter with golang for iOS and Android.
I intend to extend it for all Desktops too.

Nathan Fisher

unread,
Mar 10, 2018, 6:32:31 PM3/10/18
to Ged Wed, Justin Israel, golang-nuts
Oh that’s awesome! I didn’t realise they were supporting desktop now. It sounded like it was abandoned in a push to focus on the mobile experience.
--
- sent from my mobile

Justin Israel

unread,
Mar 10, 2018, 7:10:14 PM3/10/18
to Nathan Fisher, Ged Wed, golang-nuts


On Sun, Mar 11, 2018, 12:31 PM Nathan Fisher <nfi...@junctionbox.ca> wrote:
Oh that’s awesome! I didn’t realise they were supporting desktop now. It sounded like it was abandoned in a push to focus on the mobile experience.
On Sat, Mar 10, 2018 at 4:36 PM, Ged Wed <ged...@gmail.com> wrote:
I used QT for 6 months and Flutter is way ahead.
QT has a huge licensing issue. You can only use QT and not pay a yearly fee of 3 k if you provide the ability for end users to recompile your app against QT.
Also it's got a lot of rough edges once you get into the 80/20 situation on real world apps.
It takes 20% of your time to get 80% of your app done, and 80% of your time to get the last 20% of your app done.
Flutters plug-in system avoids you getting cornered in the 80/20 situation.

I started to do an integration of botldb and some other golang code but am half way through. From what I can see there are no roadblocks. There is one issue with APK packing but I think it just need a script to fix it.
I have not published on GitHub yet because it's not done but will..gedw99 is my GitHub org 

There is a repo there called CI where I am also getting continuous build going for flutter with golang for iOS and Android.
I intend to extend it for all Desktops too.


I didn't know flutter was also targeting desktops. I've got many years of Qt experience on desktops, so teaching for a mobile Qt solution felt like a natural first choice. But it is a real motivation to look at flutter if I can use it in the desktop space as well. 

alex.e...@gmail.com

unread,
Mar 11, 2018, 12:05:02 AM3/11/18
to golang-nuts
Am very much looking towards a straighter means to work with dart.The plugin system if possible would be a great start. I too would love any help that can be provided.

Brian Slesinsky

unread,
Mar 11, 2018, 12:37:27 AM3/11/18
to golang-nuts

On Saturday, March 10, 2018 at 12:28:19 PM UTC-8, Ged Wed wrote:

Flutter now runs on all desktops and mobiles officially. The desktop version was announced 2 weeks ago and already Linux and macOS works, with Windows probably being a few weeks away from what I guesstimate.


Could you explain where you read that there's official support for Flutter on desktop? I don't see an announcement at flutter.io, the Twitter account, or mailing list. There is what appears to be an experimental project [1] but it says "This is an exploratory effort, and is not part of the Flutter project."


Ged Wed

unread,
Mar 11, 2018, 11:18:22 AM3/11/18
to golang-nuts
This is the repo the flutter team are doing the flutter desktop.

https://github.com/google/flutter-desktop-embedding

It's the same code as runs on mobile essentially except they have an embedding API designed into flutter to allow it to be embedded onto desktop.

I am not 100% sure because it's only been up for 2 weeks but I think they are using glfw to embed on Windows, macOS and Linux.

The maxIS works today . I have tried it.
Linux apparently works.
Windows is being worked on.

It's not a huge take to support desktops because flutter and skia do 99% of the work and they have planned desktops architecturally for a long time by having their embedding API.

It's not plain sailing yet !.it's only been 2 weeks..but it's getting commits every day and docs and easy make files are not quite there yet.

That's why I started the CI project. To build up the make files and the continuous builds on the various CI cloud based platforms

I am using bitrise which is a great CI platform that is 100% written in golang too.
They virtualize macOS using VMware virt.
But the exact same CI script you can run on your own macOS too.
They don't support Windows. So I guess I will use appveyor.

Luckily setting up a script to install flutter is 2 lines of code for windows or other OS's

Hope this helps.

matthe...@gmail.com

unread,
Mar 11, 2018, 12:43:59 PM3/11/18
to golang-nuts
For my web application I previously reached the conclusion that the best approach is to write independent clients with the platform programming and visual design language instead of trying something cross-platform.

I can see Flutter or QT being great for “we need this to work everywhere and can sacrifice quality”, but for cases where I really need the performance and look (which I don’t imagine shares a lot between platforms) is there argument against just having a native app calling a Go library for the HTTP client functionality?

Matt

Ged Wed

unread,
Mar 19, 2018, 3:18:26 AM3/19/18
to golang-nuts
It's a horses for courses situation Matt.

I can live with Material design everywhere with a customised there so I emget the same branded corporate look everywhere.

I gave up matching the native OS. It's futile and just way too much work.

Don't kill me but it's really down to your philosophy in the end.

matthe...@gmail.com

unread,
Mar 19, 2018, 9:55:39 AM3/19/18
to golang-nuts
I gave up matching the native OS. It's futile and just way too much work. 
Don't kill me but it's really down to your philosophy in the end.

I’m asking because I’ve only done a web interface (where a cross-browser standardization library is useful for me), but I’ve used plenty of apps/programs that have terrible performance, look, interaction, or other problems, which doesn’t seem acceptable but still is ubiquitous for some reason. If I make something with a UI I don’t want to repeat those mistakes again and effort savings by Flutter is intriguing.

Thanks for your feedback.

Matt

lon...@gmail.com

unread,
Mar 20, 2018, 10:21:02 AM3/20/18
to golang-nuts
I just tried lots of time, but failed again and again, in android, simulator and real phone too go in dead.

//import bond.Bond;
"Bond.thirdCall();" is written by go and compiled by gomobile,when it call ,program stop.

private int getBatteryLevel() {
int batteryLevel = -1;
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
BatteryManager batteryManager = (BatteryManager) getSystemService(BATTERY_SERVICE);
batteryLevel = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
} else {
Intent intent = new ContextWrapper(getApplicationContext()).
registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
batteryLevel = (intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100) /
intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
}
Bond.thirdCall();
if (goreturns=="20180311") {
if (remotecallcount < 10) {
remotecallcount = remotecallcount + 1;
}
}else{
remotecallcount = remotecallcount + 2;
}
return (batteryLevel*remotecallcount)/10;
}

here is bond.go

package bond


import (


)


func FirstCall() int{

return 20180311

}


func SecondCall() string{

return "20180311"

}


func ThirdCall() {

}


在 2018年3月11日星期日 UTC+8上午4:28:19,Ged Wed写道:
simulator.png

Ged Wed

unread,
Apr 23, 2018, 2:21:12 PM4/23/18
to golang-nuts
I used to build only web based up.
But you hit so many corner cases.
With flutter you get pixel perfect control as deep as you need.

To me you get much higher quality UI from flutter.
And you don't have a untyped web runtime designed 20 years ago to deal with.

My harsh 2 cents I admit... But really never going back to web for something I actually have to support.

Ged Wed

unread,
Apr 23, 2018, 2:22:15 PM4/23/18
to golang-nuts
It's because your compiling to the wrong ISA. If it's an emulator then you need to gomobile bind to x86.
Reply all
Reply to author
Forward
0 new messages