The main purpose of the Klutter Gradle Plugin is to connect a Flutter frontend with a Kotlin Multiplatform backend. This plugin provides a set of Gradle tasks which will generate anything from settings files to Kotlin/Dart/Groovy code needed to make Flutter and KMP work together.
Important: For using and/or creating Flutter plugins with Klutter you should use the pub plugin.
Preferred way of installing/using this plugin is by starting a new project with one of:
- Intellij plugin
- Android Studio plugin
- Kradle cli tool
The gradle plugin defines tasks for compiling the Kotlin Multiplatform module, generating Dart code and more. Some tasks are executed automatically before (compiler plugin) and after running a gradle build.
- klutterCompileProtoSchemas
- klutterCopyAarFile
- klutterCopyFramework
- klutterGenerateFlutterLib
- klutterGenerateProtoSchemas
- klutterGetDartProtoc
- klutterGetKradle
- klutterGetProtoc
Compile protocol buffer schemas which generates boilerplate code for both Kotlin and Dart. This task does nothing when the protobuf feature is not enabled.
Copy the root/platform aar file to root/android folder.
Copy the root/platform iOS Framework to root/ios folder.
Generate the Dart library file in the root/lib folder.
Generate protocol buffer schemas which can be used by klutterCompileProtoSchemas. This task does nothing when the protobuf feature is not enabled.
Download the dart protobuf plugin.
Download the kradle cli tool.
Download the protoc executable tool. The distribution url can be specified in the kradle.env file:
protoc.url=https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-osx-universal_binary.zip