As we all know Flutter extended its supports for linux recently with canonical. With this, we can build and deploy applications for linux with Flutter more easily now.

Start by upgrading Flutter

flutter channel master
flutter upgrade

Enable Linux Support in Flutter

flutter config --enable-linux-desktop

Let’s create a simple battery plugin

In this example we will create a plugin which will give us the battery percentage level and its technology.

flutter create -t plugin --platforms=linux battery

Analyzing the environment

In your plugin folder, you get the lib folder which contains the battery.dart file which will handle your method channels, an example folder which contains a sample application to demonstrate the use of your plugin and a linux folder which contains battery_plugin.cc file which will handle your platform level methods. Platform level code is written in C++ for Linux.

#flutter #app-development #linux #open-source #github

Writing Plugins for Linux in Flutter
6.10 GEEK