File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff 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));
You can’t perform that action at this time.
0 commit comments