[英]how use the eventchannel of flutter for desktop on windows?
我想使用事件通道通知顫動,但我找不到關於桌面(Windows)事件通道的任何示例。
mothed通道為雙工模式,dart通過“channel”+“funtion”調用原生函數,同理,原生調用dart函數也是如此。
1、使用cmd:
flutter create -t plugin --platforms=linux,macos,windows window_to_front
2、查找功能:
RegisterWithRegistrar
3、在“RegisterWithRegistrar”函數中使用“channel”:
channel->InvokeMethod("foo", nullptr, nullptr)
4、在dart中注冊“channel”和“function”:
var channel = MethodChannel("test2");
channel.setMethodCallHandler((call) {
switch(call.method) {
case "foo": {
//String msg = call.arguments["msg"];
print("Native invoke Flutter susscess,params:${call.arguments}");
//return "success";
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.