Create your first plugin
If you are comfortable with Dart, Flutter and Hetu Script, you can start developing your first plugin. This guide will help you initialize a plugin project and write your first plugin.
Initializing a plugin project
spotube-plugin-template is a template repository for Spotube plugins. It's a starting point with everything you need to get started with plugin development. You should use it to create your own plugin.
Simply clone or click "Use this template" button on the GitHub repository page to create a new repository.
$ git clone https://github.com/KRTirtho/spotube-plugin-template.git
$ cd spotube-plugin-template
Understanding plugins.json
After cloning the repository, you will find a file named plugins.json in the root directory.
This file is crucial for Spotube to recognize your plugin. It looks like this:
{
"type": "metadata",
"version": "1.0.0",
"name": "Alphanumeric plugin name with hyphens or underscore",
"author": "Your Name",
"description": "A brief description of the plugin's functionality.",
"entryPoint": "plugin class name",
"apis": ["webview", "localstorage", "timezone"],
"abilities": ["authentication", "scrobbling"],
"repository": "https://github.com/KRTirtho/spotube-plugin-template",
"pluginApiVersion": "1.0.0"
}
Change the values in the plugins.json file to match your plugin's information.
Running the example app
There's an example folder that contains a simple Flutter app that utilizes all the methods
Spotube would call on your plugin. You can run this app to test your plugin's functionality.
But first you need too compile the plugin to bytecode. You can simply do this using:
$ make
Make sure you've make command installed on your system and also must have the hetu_script_dev_tools package globally installed.
After compiling the plugin, you can run the example app like any other Flutter app.
$ cd example
$ flutter run
Most of the buttons, will not work as they not yet implemented. You've to implement the methods in your plugin source code. We will cover how to implement the methods in the next section.