[][src]Trait flutter_engine::channel::Channel

pub trait Channel {
    type R;
    type Codec: MethodCodec<R = Self::R>;
    fn get_name(&self) -> &str;
fn init(&self, registry: *const PluginRegistry);
fn get_engine(&self) -> Option<Weak<FlutterEngineInner>>; fn invoke_method(&self, method_call: MethodCall<Self::R>) { ... }
fn decode_method_call(&self, msg: &PlatformMessage) -> MethodCall<Self::R> { ... }
fn send_success_event(&self, data: &Self::R) { ... }
fn send_error_event(&self, code: &str, message: &str, data: &Self::R) { ... }
fn send_method_call_response(
        &self,
        response_handle: Option<&FlutterPlatformMessageResponseHandle>,
        ret: MethodCallResult<Self::R>
    ) -> bool { ... }
fn send_response(
        &self,
        response_handle: &FlutterPlatformMessageResponseHandle,
        buf: &[u8]
    ) { ... }
fn send_platform_message(&self, msg: &PlatformMessage) { ... } }

Associated Types

type R

type Codec: MethodCodec<R = Self::R>

Loading content...

Required methods

fn get_name(&self) -> &str

fn init(&self, registry: *const PluginRegistry)

fn get_engine(&self) -> Option<Weak<FlutterEngineInner>>

Loading content...

Provided methods

fn invoke_method(&self, method_call: MethodCall<Self::R>)

Invoke a flutter method using this channel

fn decode_method_call(&self, msg: &PlatformMessage) -> MethodCall<Self::R>

Decode dart method call

fn send_success_event(&self, data: &Self::R)

When flutter listen to a stream of events using EventChannel. This method send back a success event. It can be call multiple times to simulate stream.

fn send_error_event(&self, code: &str, message: &str, data: &Self::R)

When flutter listen to a stream of events using EventChannel. This method send back a error event. It can be call multiple times to simulate stream.

fn send_method_call_response(
    &self,
    response_handle: Option<&FlutterPlatformMessageResponseHandle>,
    ret: MethodCallResult<Self::R>
) -> bool

Send a method call response

fn send_response(
    &self,
    response_handle: &FlutterPlatformMessageResponseHandle,
    buf: &[u8]
)

When flutter call a method using MethodChannel, it can wait for rust response using await syntax. This method send a response to flutter. This is a low level method. Please use send_method_call_response if that will work.

fn send_platform_message(&self, msg: &PlatformMessage)

Send a platform message over this channel. This is a low level method.

Loading content...

Implementors

impl Channel for JsonMethodChannel[src]

type Codec = JsonMethodCodec

type R = Value

fn invoke_method(&self, method_call: MethodCall<Self::R>)[src]

fn decode_method_call(&self, msg: &PlatformMessage) -> MethodCall<Self::R>[src]

fn send_success_event(&self, data: &Self::R)[src]

fn send_error_event(&self, code: &str, message: &str, data: &Self::R)[src]

fn send_method_call_response(
    &self,
    response_handle: Option<&FlutterPlatformMessageResponseHandle>,
    ret: MethodCallResult<Self::R>
) -> bool
[src]

fn send_response(
    &self,
    response_handle: &FlutterPlatformMessageResponseHandle,
    buf: &[u8]
)
[src]

fn send_platform_message(&self, msg: &PlatformMessage)[src]

impl Channel for StandardMethodChannel[src]

type Codec = StandardMethodCodec

type R = Value

fn invoke_method(&self, method_call: MethodCall<Self::R>)[src]

fn decode_method_call(&self, msg: &PlatformMessage) -> MethodCall<Self::R>[src]

fn send_success_event(&self, data: &Self::R)[src]

fn send_error_event(&self, code: &str, message: &str, data: &Self::R)[src]

fn send_method_call_response(
    &self,
    response_handle: Option<&FlutterPlatformMessageResponseHandle>,
    ret: MethodCallResult<Self::R>
) -> bool
[src]

fn send_response(
    &self,
    response_handle: &FlutterPlatformMessageResponseHandle,
    buf: &[u8]
)
[src]

fn send_platform_message(&self, msg: &PlatformMessage)[src]

Loading content...