这是导航的代码:
startActivity(
FlutterActivity
.withNewEngine()
.initialRoute("/my_route")
.build(this)
)
这是导航的代码:
startActivity(
FlutterActivity
.withNewEngine()
.initialRoute("/my_route")
.build(this)
)
您可以将包含您的数据的地图作为 invokeMethod() 的额外参数。然后,您可以在本机代码中以 call.argument("yourFieldName") 的形式接收它。
扑:
static const MethodChannel _channel = MethodChannel('yourChannelName');
_channel.invokeMethod('play', <String, dynamic>{
'song': song.id,
'volume': volume,
});
爪哇:
public void onMethodCall(MethodCall call, Result result) {
switch (call.method) {
case "play":
final String song = call.argument("song");
final double volume = call.argument("volume");
break;
[...]