September 2019
Beginner
512 pages
12h 52m
English
As we have seen, the default project template generates a small code that gets the platform version. Let's take a look at the generated code in HandsOnPlatformVersionPlugin.kt, which is in the Android subproject com.example.hands_on_platform_version package. This single file is the entrypoint of the plugin:
// HandsOnPlatformVersionPlugin.ktclass HandsOnPlatformVersionPlugin: MethodCallHandler { companion object { fun registerWith(registrar: Registrar) { // 1 val channel = MethodChannel(registrar.messenger(), "hands_on_platform_version") channel.setMethodCallHandler(HandsOnPlatformVersionPlugin()) } } override fun onMethodCall(call: MethodCall, result: Result) { // 2 if (call.method == "getPlatformVersion") ...Read now
Unlock full access