Skip to content

New Plugin: uni_links #240

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

Open
StefanLobbenmeier opened this issue Aug 23, 2019 · 15 comments
Open

New Plugin: uni_links #240

StefanLobbenmeier opened this issue Aug 23, 2019 · 15 comments
Labels
plugin Issue about an existing or possible plugin wontfix This will not be worked on

Comments

@StefanLobbenmeier
Copy link
Contributor

Hi,
I will probably need to use uni_links soon-ish. That will probably require some research, so I just wanted to create this issue to collect any info I can find.

@StefanLobbenmeier
Copy link
Contributor Author

@pchampio pchampio added the plugin Issue about an existing or possible plugin label Aug 23, 2019
@provokateurin
Copy link
Member

@ykmnkmi
Copy link

ykmnkmi commented Sep 7, 2019

Is possible to pass arguments from go app to dart main function?

@pchampio
Copy link
Member

pchampio commented Sep 7, 2019

Is possible to pass arguments from go app to dart main function?

No and you should avoid putting business code above runAp because it delays the first frame.

For needs described above you can use the following system channel: https://api.flutter.dev/flutter/services/SystemChannels/navigation-constant.html

pushRoute, which is called with a single string argument when the operating system instructs the application to open a particular page.

You can make a go-flutter plugin that invoke this method https://github.com/go-flutter-desktop/go-flutter/wiki/Implement-a-plugin#call-dart-from-golang


Edit add simple example:
Golang:

channel := plugin.NewMethodChannel(p.messenger, "flutter/navigation", plugin.JSONMethodCodec{})
channel.InvokeMethod("pushRoute", "/anotherRoute")

Dart:

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      routes: <String, WidgetBuilder>{
        '/anotherRoute': (BuildContext context) =>
            Scaffold(body: Text("anotherRoute")),
        //other routes
      },
      home: Scaffold(body: Text("Home")),
    );
  }
}

@StefanLobbenmeier
Copy link
Contributor Author

StefanLobbenmeier commented Sep 7, 2019 via email

@pchampio
Copy link
Member

pchampio commented Sep 7, 2019

I think this process then needs to start the actual app (if needed) and deliver the message. Is that
understanding correct?

I'm not an expert, but I does match my browser behavior, when I click on a link in the terminal either my browser is started with the link, or a new tab is opened.

Is there any standard way for inter process commutation in go?

again, not a big expert in that domain.
There is https://github.com/ybbus/jsonrpc , without much search that what I would use^^

@joeblew99

This comment has been minimized.

@joaopmarquesini
Copy link

any news on this? I'm willing to use move my app to go-flutter but lack the necessary knowledge to implement it myself.
I implemented uni_links for macos on the FDE side if it helps somehow
https://github.com/LittleLightForDestiny/littlelight/tree/desktop/desktop_plugins/uni_links_fde/macos

@provokateurin
Copy link
Member

You could re-use your MacOS implementation to create a CGO plugin, but that still requires the knowledge of go and go-flutter plugins.

@joaopmarquesini
Copy link

is there some knowledge base or a quickstart for plugins ?
I was stuck while trying to create a minimal example to proper "test" my plugin.
Also, is there already a repo for this plugin ? Or should I create a new one ?

@provokateurin
Copy link
Member

Here are the official go-flutter plugins: https://github.com/go-flutter-desktop/plugins
For the repo you can just upload it to your own account.

@pchampio
Copy link
Member

is there some knowledge base or a quickstart for plugins ?
I was stuck while trying to create a minimal example to proper "test" my plugin.

Yes, sure, checkout our wiki:
https://github.com/go-flutter-desktop/go-flutter/wiki/Plugin-info
https://github.com/go-flutter-desktop/go-flutter/wiki/Create-a-hover-compatible-plugin
https://github.com/go-flutter-desktop/go-flutter/wiki/Implement-a-plugin

@provokateurin
Copy link
Member

The problem on implementing it for linux is that only the .desktop file can specify a custom protocol handler

@GeertJohan
Copy link
Member

So aside from the code part, there will also be need to change something during packaging? Perhaps this can be related to the hooks discussion?

@joaopmarquesini
Copy link

@GeertJohan probably. In macOS i need to change the Info.plist to add the url schemes. Also the way go-flutter runs its dev builds on mac doesn't support that (it isn't a packaged .app) so it could be a bit hard to test this kind of feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Issue about an existing or possible plugin wontfix This will not be worked on
Development

No branches or pull requests

7 participants