Skip to content

Commit 99322ce

Browse files
committed
linux: native support for app stop
1 parent 1734649 commit 99322ce

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

linux/flutter/flutter_dart.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,15 @@ void InitMethodChannel(FlView* flutter_instance) {
353353
/* TODO: if (strcmp("app.stat", method_name) == 0) {
354354
} else if (strcmp("app.start", method_name) == 0) {
355355
} else if (strcmp("app.restart", method_name) == 0) {
356-
} else if (strcmp("app.stop", method_name) == 0) {
357-
} else*/ if (strcmp("util.ip", method_name) == 0) {
356+
} else*/ if (strcmp("app.stop", method_name) == 0) {
357+
FlValue *args = fl_method_call_get_args(method_call);
358+
if (fl_value_get_type(args) != FL_VALUE_TYPE_LIST || fl_value_get_length(args) < 1) RETURN_BADARG_ERR(app.stop);
359+
FlValue *name_ = fl_value_get_list_value(args, 0);
360+
if (fl_value_get_type(name_) != FL_VALUE_TYPE_STRING) RETURN_BADARG_ERR(app.stop);
361+
std::string name = std::string(fl_value_get_string(name_));
362+
appStop(name);
363+
response = FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
364+
} else if (strcmp("util.ip", method_name) == 0) {
358365
g_autoptr(FlValue) val = fl_value_new_map();
359366
utilGetIps(val);
360367
response = FL_METHOD_RESPONSE(fl_method_success_response_new(val));

0 commit comments

Comments
 (0)