Skip to content

Conversation

@swift-kim
Copy link
Member

Contributes to #348.

The platform interface package's default implementation has recently been removed (flutter/plugins#6341) and the platform interface must be explicitly implemented by each platform package.

Pigeon (4.2.9) was used to auto-generate the binding code (Dart and C++) in this PR. Currently pigeon's C++ generator has this bug and the Tizen SDK (which uses Clang as a compiler) emits an error when compiling the generated code. I applied the following patch before running flutter pub run pigeon to mitigate the issue.

diff --git a/lib/cpp_generator.dart b/lib/cpp_generator.dart
index 9c369a5..28e1ca8 100644
--- a/lib/cpp_generator.dart
+++ b/lib/cpp_generator.dart
@@ -131,7 +131,7 @@ void _writeCodecSource(Indent indent, Api api, Root root) {
         indent.scoped('{', '}', () {
           indent.writeln('stream->WriteByte(${customClass.enumeration});');
           indent.writeln(
-              'WriteValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableMap(), stream);');
+              'WriteValue(flutter::EncodableValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableMap()), stream);');
           indent.writeln('return;');
         });
       }
@@ -589,7 +589,7 @@ const flutter::StandardMessageCodec& ${api.name}::GetCodec() {
                     indent.scoped('{', '}', () {
                       indent.writeln(
                           'wrapped.emplace(flutter::EncodableValue("${Keys.error}"), WrapError("$argName unexpectedly null."));');
-                      indent.writeln('reply(wrapped);');
+                      indent.writeln('reply(flutter::EncodableValue(wrapped));');
                       indent.writeln('return;');
                     });
                   }
@@ -660,7 +660,7 @@ $prefix\t}${indent.newline}''';
               if (method.isAsynchronous) {
                 methodArgument.add(
                   '[&wrapped, &reply]($returnTypeName&& output) {${indent.newline}'
-                  '${wrapResponse('\treply(wrapped);${indent.newline}', method.returnType)}'
+                  '${wrapResponse('\treply(flutter::EncodableValue(wrapped));${indent.newline}', method.returnType)}'
                   '}',
                 );
               }
@@ -678,11 +678,11 @@ $prefix\t}${indent.newline}''';
               indent.writeln(
                   'wrapped.emplace(flutter::EncodableValue("${Keys.error}"), WrapError(exception.what()));');
               if (method.isAsynchronous) {
-                indent.writeln('reply(wrapped);');
+                indent.writeln('reply(flutter::EncodableValue(wrapped));');
               }
             });
             if (!method.isAsynchronous) {
-              indent.writeln('reply(wrapped);');
+              indent.writeln('reply(flutter::EncodableValue(wrapped));');
             }
           });
         });

Notes:

  • The pigeon file (pigeons/messages.dart) is a copy of video_player_android's messages.dart with a few minor changes (seekTo is marked @async).
  • video_player_tizen.dart is a copy of video_player_android's android_video_player.dart with a few minor changes.

@swift-kim swift-kim merged commit 6000e94 into flutter-tizen:master Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants