@@ -12,7 +12,6 @@ static constexpr char kChannelName[] = "flutter/platform";
1212static constexpr char kBadArgumentsError [] = " Bad Arguments" ;
1313static constexpr char kUnknownClipboardFormatError [] =
1414 " Unknown Clipboard Format" ;
15- static constexpr char kClipboardRequestError [] = " Clipboard Request Failed" ;
1615static constexpr char kFailedError [] = " Failed" ;
1716static constexpr char kGetClipboardDataMethod [] = " Clipboard.getData" ;
1817static constexpr char kSetClipboardDataMethod [] = " Clipboard.setData" ;
@@ -43,17 +42,14 @@ static void clipboard_text_cb(GtkClipboard* clipboard,
4342 gpointer user_data) {
4443 g_autoptr (FlMethodCall) method_call = FL_METHOD_CALL (user_data);
4544
46- g_autoptr (FlMethodResponse) response = nullptr ;
45+ g_autoptr (FlValue) result = nullptr ;
4746 if (text != nullptr ) {
48- g_autoptr (FlValue) result = fl_value_new_map ();
47+ result = fl_value_new_map ();
4948 fl_value_set_string_take (result, kTextKey , fl_value_new_string (text));
50- response = FL_METHOD_RESPONSE (fl_method_success_response_new (nullptr ));
51- } else {
52- response = FL_METHOD_RESPONSE (fl_method_error_response_new (
53- kClipboardRequestError , " Failed to retrieve clipboard text from GTK" ,
54- nullptr ));
5549 }
5650
51+ g_autoptr (FlMethodResponse) response =
52+ FL_METHOD_RESPONSE (fl_method_success_response_new (result));
5753 send_response (method_call, response);
5854}
5955
0 commit comments