@@ -1014,19 +1014,19 @@ of your choice. The instructions below are for Visual Studio Code with the
1014
1014
1 . Choose ** Yes** in the prompt asking: ` Would you like to configure project "linux"? ` .
1015
1015
This enables C++ autocomplete.
1016
1016
1017
- 1 . Open the file ` my_application.cc ` .
1017
+ 1 . Open the file ` runner/ my_application.cc` .
1018
1018
1019
1019
First, add the necessary includes to the top of the file, just
1020
1020
after ` #include <flutter_linux/flutter_linux.h> ` :
1021
1021
1022
- ``` c title="my_application.cc"
1022
+ ``` c title="runner/ my_application.cc"
1023
1023
#include < math.h>
1024
1024
#include < upower.h>
1025
1025
```
1026
1026
1027
1027
Add an ` FlMethodChannel ` to the ` _MyApplication ` struct:
1028
1028
1029
- ``` c title="my_application.cc"
1029
+ ``` c title="runnner/ my_application.cc"
1030
1030
struct _MyApplication {
1031
1031
GtkApplication parent_instance;
1032
1032
char** dart_entrypoint_arguments;
@@ -1036,7 +1036,7 @@ struct _MyApplication {
1036
1036
1037
1037
Make sure to clean it up in ` my_application_dispose ` :
1038
1038
1039
- ``` c title="my_application.cc"
1039
+ ``` c title="runner/ my_application.cc"
1040
1040
static void my_application_dispose (GObject* object) {
1041
1041
MyApplication* self = MY_APPLICATION(object);
1042
1042
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
@@ -1050,7 +1050,7 @@ Edit the `my_application_activate` method and initialize
1050
1050
`samples.flutter.dev/battery`, just after the call to
1051
1051
`fl_register_plugins`:
1052
1052
1053
- ```c title="my_application.cc"
1053
+ ```c title="runner/ my_application.cc"
1054
1054
static void my_application_activate(GApplication* application) {
1055
1055
// ...
1056
1056
fl_register_plugins(FL_PLUGIN_REGISTRY(self->view));
@@ -1073,7 +1073,7 @@ you would write in a native Linux application.
1073
1073
Add the following as a new function at the top of
1074
1074
` my_application.cc ` just after the ` G_DEFINE_TYPE ` line:
1075
1075
1076
- ``` c title="my_application.cc"
1076
+ ``` c title="runner/ my_application.cc"
1077
1077
static FlMethodResponse* get_battery_level () {
1078
1078
// Find the first available battery and report that.
1079
1079
g_autoptr (UpClient) up_client = up_client_new();
@@ -1103,7 +1103,7 @@ is called, report that instead.
1103
1103
1104
1104
Add the following code after the ` get_battery_level ` function:
1105
1105
1106
- ``` cpp title="my_application.cpp"
1106
+ ``` cpp title="runner/ my_application.cpp"
1107
1107
static void battery_method_call_handler (FlMethodChannel* channel,
1108
1108
FlMethodCall* method_call,
1109
1109
gpointer user_data) {
0 commit comments