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