Exemplo n.º 1
0
        /// <summary>
        /// Invokes a method on this channel, expecting a result.
        /// </summary>
        /// <remarks>
        /// A <see cref="FlutterException"/> is thrown, if the invocation failed in the Flutter application.
        /// </remarks>
        /// <param name="call">A <see cref="MethodCall"/>.</param>
        /// <returns>A <see cref="Task"/> that completes with a result.</returns>
        public async Task <object> InvokeMethodAsync(MethodCall call)
        {
            if (call == null)
            {
                throw new ArgumentNullException(nameof(call));
            }
            byte[] result = await BinaryMessenger.SendAsync(Name, Codec.EncodeMethodCall(call));

            return(Codec.DecodeEnvelope(result));
        }