Slide 57
Slide 57 text
BasicMessageChannel
Future position(TextureMessage arg) async {
final Object encoded = arg.encode();
const BasicMessageChannel channel = BasicMessageChannel(
'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
final Map? replyMap =
await channel.send(encoded) as Map?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
details: null,
);
} else if (replyMap['error'] != null) {
final Map error =
replyMap['error'] as Map;
throw PlatformException(
code: error['code'] as String,
message: error['message'] as String?,
details: error['details'],
);
} else {
return PositionMessage.decode(replyMap['result']!);
}
}