native_ui_builder_generator 0.0.1-beta
native_ui_builder_generator: ^0.0.1-beta copied to clipboard
A code generator for native_ui_builder that translates Dart AST into Swift and Kotlin.
native_ui_builder_generator #
This is the code generator package for native_ui_builder.
It utilizes build_runner and the Dart analyzer to parse classes annotated with @NativeComponent and automatically generates:
- SwiftUI Code (
.swift) for iOS. - Jetpack Compose Code (
.kt) for Android. - Dart PlatformView Wrappers (
.native.dart) to seamlessly bridge the native components into your Flutter widget tree.
Getting Started #
You should not depend on this package directly in your dependencies. Instead, add it to your dev_dependencies alongside build_runner.
dependencies:
flutter:
sdk: flutter
native_ui_builder: ^0.0.1-beta
dev_dependencies:
build_runner: ^2.4.0
native_ui_builder_generator: ^0.0.1-beta
Usage #
After defining a @NativeComponent in your Flutter app using the native_ui_builder primitives, run the generator:
dart run build_runner build --delete-conflicting-outputs
This will generate the required .native.dart, .swift, and .kt files. Please refer to the native_ui_builder package for complete instructions on how to use the framework and wire up the native code in your Xcode and Android Studio projects.