Open the file my_application.cc.

First, add the necessary includes to the top of the file, just
after #include <flutter_linux/flutter_linux.h:

#include

<math.h>

#include

<upower.h>

Add an FlMethodChannel to the _MyApplication struct:

struct

_MyApplication

GtkApplication

parent_instance

char

*

dart_entrypoint_arguments

FlMethodChannel

battery_channel

};

Make sure to clean it up in my_application_dispose:

static

void

my_application_dispose

GObject

object

MyApplication

self

MY_APPLICATION