I know it is possible and maybe common to call native code from dart via method channel, but does it works both ways (how to call a method which is written in dart from kotlin or swift)?
Asked
Active
Viewed 18 times
0
-
yes it works both ways: from native you call e method, from dart you have to set method call handler – pskink Oct 10 '22 at 17:55
-
@pskink can you share some example or maybe you have link to documentations? – 1encore Oct 10 '22 at 17:56
-
1https://api.flutter.dev/flutter/services/MethodChannel-class.html and https://api.flutter.dev/javadoc/io/flutter/plugin/common/MethodChannel.html – pskink Oct 10 '22 at 17:57
-
@pskink that would definitely help me, thanks a lot! – 1encore Oct 10 '22 at 18:05
-
1Here's a complete example I used for a talk a few years ago: https://github.com/richardheap/audio_worklet – Richard Heap Oct 10 '22 at 19:08