Skip to content

Plugin info

Pierre Champion edited this page Apr 26, 2019 · 18 revisions

go-flutter exposes the flutter's platform-channels allowing you to write platform-specific code.
Plugins is where this project shine, with the power of Golang we only have to write multi-platform plugin once.

Add plugins to your application

To add plugin you need to use AddPlugin

If you are using hover edit desktop/cmd/options.go.

Example:

package main

import (
	"github.com/go-flutter-desktop/go-flutter"
	"github.com/go-flutter-desktop/plugins/path_provider"
)

var options = []flutter.Option{
	flutter.WindowInitialDimensions(800, 600),
	flutter.AddPlugin(&path_provider.PathProviderPlugin{
		VendorName:      "myOrganizationOrUsername",
		ApplicationName: "myApplicationName",
	}),
	// flutter.AddPlugin(&someOtherPlugin),
}

Implement a plugin

If you want to implement a plugin make sure to read an existing implementation: path_provider is a good example.

For more information, read the GoDoc: here and here.