This is the code to navigate:
startActivity(
FlutterActivity
.withNewEngine()
.initialRoute("/my_route")
.build(this)
)
This is the code to navigate:
startActivity(
FlutterActivity
.withNewEngine()
.initialRoute("/my_route")
.build(this)
)
You can put a map containing your data as an extra parameter of the invokeMethod(). Then you can receive it in your native code as call.argument("yourFieldName").
Flutter:
static const MethodChannel _channel = MethodChannel('yourChannelName');
_channel.invokeMethod('play', <String, dynamic>{
'song': song.id,
'volume': volume,
});
Java:
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;
[...]