diff --git a/annotations/annotations/dev.buijs.klutter.annotations/-android-context/-android-context.html b/annotations/annotations/dev.buijs.klutter.annotations/-android-context/-android-context.html new file mode 100644 index 00000000..b1b23efc --- /dev/null +++ b/annotations/annotations/dev.buijs.klutter.annotations/-android-context/-android-context.html @@ -0,0 +1,45 @@ + +
+ +Annotation for class which require an instance of Android Context.
When a class is annotated with this annotation then an instance of Android Context is passed to the class constructor in the generated Android adapter.
The klutter framework chooses between Singleton and RequestScoped depending on the type of controller.
A new instance of the controller is made everytime an event is triggerd.
Only one instance of the controller is made during the app's lifecycle.
All methods contained by a class annotated with Controller will be added to the generated iOS/Android adapters.
Annotation which informs Klutter to implement multiple method channel calls to pass KlutterEvents to this Controller class.
Should be used in conjunction with KomposeController super class.
Annotation which denotes the annotated function as part of the Flutter - KMP interface.
When a function with this annotation is scanned, a method channel call delegation will be generated.
Annotation for data classes in the KMP module which are possibly used by functions annotated with dev.buijs.klutter.annotations.Event.
Dart classes will be generated to enable typesafe communication between Flutter and KMP.
Parsed ksp options used by Processor.
Available options are:
klutterScanFolder: Folder to scan for klutter annotations.
klutterOutputFolder: Folder where to write analysis results.
klutterGenerateAdapters: Boolean value indicating if codegen tasks should run during build.
intelMac: Boolean value indicating if the platform is an Intel-based Mac.
The provider which will return an instance of Processor.
The build.gradle(.kts) of the workload module should contain a ksp DSL block with the following option:
key: klutterScanFolder,
value: path to folder where scan result is stored.
If the klutterScanFolder is not set then a KlutterException is thrown. If the folder does not exist then a KlutterException is thrown. See ProcessorOptions for all available configuration options.
The actual symbol processor which will scan all classes with Klutter annotations and run code generation tasks as configured.
A Jetbrains 'kotlin' inspired dependency handler which makes it easier to add klutter dependencies in a build.gradle(.kts) file as follows:
klutter {
implementation("annotations")
implementation("annotations", version = "2022.r8")
}
Add klutter testImplementation dependency to this project.
Add klutter implementation dependency to this project.
Glue for the DSL used in a build.gradle(.kts) file and the Klutter tasks.
Configure the Gradle Plugin for a klutter plugin (consumer or producer).
Gradle plugin for Klutter Framework.
Common text messages.
Klutter Logo's in Icon format.
When the button is clicked then open a new project wizard.
Action to start the new project wizard.
In this wizard, the NewProjectWizardStep can be selected. This is made available in the wizard options through the NewProjectBuilder. This builder is added in the resources/META-INF/plugin.xml as an extension.
Adds a button named 'New Klutter Project' to the Welcome Screen.
Load the NewProjectWizardStep where the user can enter the Klutter project configuration.
Builder which returns a wizard to input project details with which a new klutter project is created.
This builder is added in the resources/META-INF/plugin.xml as an extension.
Generate the actual project.
Configure Java SDK.
Klutter Gradle version to use.
Wrapper for data used to create a new project.
Get pub dependencies from Git or Pub.
Show the panel to receive user input.
Displays a new project screen for Klutter in the standard new project wizard.
This wizard can be accessed by going to:
Intellij: File - New - Project... and then in the left pane click on Klutter.
Android Studio: File - New - New Klutter Project... and then in the left pane click on Klutter.
Update the NewProjectConfig data.
Validate the NewProjectConfig data and display an error pop-up if invalid.
Result returned after validating user input.
Validate a NewProjectConfig instance.
Cancel the broadcast.
Subscribe to the broadcast and receive messages.
Subscribe to the broadcast and receive messages.
Flow
Parent for all types in the ast package.
A not null Boolean StandardType.
A not null ByteArray StandardType.
Data wrapper for classes annotated with @Controller.
A user defined class.
Example:
package com.example
class Response(
val foo: Foo
)
is CustomType:
name: "Response"
package: "com.example"
members: []
A not null DoubleArray StandardType.
A not null Double StandardType.
A user defined enum class.
Example:
package com.example
enum class GreetingType(
GREETING, HUG, HIGH_FIVE
)
is EnumType:
name: "GreetingType"
package: "com.example"
values: GREETING, HUG, HIGH_FIVE
A not null FloatArray StandardType.
A not null IntArray StandardType.
A not null Integer StandardType.
A not null List StandardType.
A not null LongArray StandardType.
A not null Long StandardType.
A not null Map StandardType.
Data class to contain information about analyzed Kotlin (Platform) code which is used to generate Dart code in the Flutter lib folder.
The actual platform method signature to be executed.
In the following example 'greeting()' is the method:
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
mainScope.launch {
when (call.method) {
"greeting" -> {
result.success(Greeting().greeting())
}
else -> result.notImplemented()
}
}
}
The type of data consumed when calling the method.
Can be a standard Kotlin/Dart type as defined in StandardTypeMap or a custom defined type.
Name of the request parameter (if any).
The type of data returned when calling the method.
Can be a standard Kotlin/Dart type as defined in StandardTypeMap or a custom defined type.
A nullable Boolean StandardType.
A nullable ByteArray StandardType.
A nullable variant of CustomType.
A nullable LongArray StandardType.
A nullable Double StandardType.
A nullable FloatArray StandardType.
A nullable IntArray StandardType.
A nullable Integer StandardType.
A nullable List StandardType.
A nullable LongArray StandardType.
A nullable Long StandardType.
A nullable LongArray StandardType.
A nullable String StandardType.
A Simple Controller which is a class with a no-arg constructor and contains one or more @Event annotated functions.
A Broadcast Controller which is a class with a no-arg constructor which extends KlutterBroadcast.
A member of a CustomType SquintCustomType.
Example:
{
"name": "a1",
"type": "int",
"nullable": false
}
Data class to serialize a Klutter CustomType to JSON, formatted in a way which can be read by dart library Squint (https://pub.dev/packages/squint_json).
Example:
{
"className": "MyResponse",
"members": [
{
"name": "a1",
"type": "int",
"nullable": false
},
{
"name": "a2",
"type": "String",
"nullable": true
}
]
}
Type data to be consumed by dart squint.
Scanned output as AbstractType.
Parent for all types that are serializable to a format that dart squint can process.
A standard Kotlin/Dart type, as defined in StandardTypeMap.
A not null String StandardType.
StandardType if member of a kotlin type StandardTypeMap
CustomType if not.
Representation of a class field member.
Unit StandardType.
StandardType if member of a kotlin type StandardTypeMap
CustomType if not.
Return a StandardType or CustomType wrapped in ValidAbstractType or InvalidAbstractType:
StandardType if member of a kotlin type StandardTypeMap
CustomType if not.
A StandardType can be valid or invalid. A CustomType is always wrapped in ValidAbstractType.
Default implementation of KlutterWriter which creates a new File and writes content to it.
Write content to the file:
Delete the file if it exists.
Create a new file.
Write content to file.
if file does not exist after creation.
Create a new folder if it does not exist.
if folder does not exist after creating it.
Create a new File if it does not exist.
if file does not exist after creating it.
Convert a String to camelCase.
Convert a String to snake_case.
Return the File or throw a KlutterException if it does not exist.
Return path to android/src/main/AndroidManifest.xml.
File AndroidManifest.xml.
if path/file does not exist.
Function to return the location of the AppDelegate.swift file in the ios folder.
the absolute path to the ios AppDelegate.
if file(s) do not exist.
Function to return the location of the PodFile in the ios sub-module. If no custom path is given, Klutter assumes the path to the iOS Podfile is root-project/ios/PodFile.
the absolute path to the ios Podfile.
if file(s) do not exist.
Function to return the location of the podspec in the ios sub-module.
the absolute path to the ios Podfile.
if file(s) do not exist.
Function to return the location of the podspec in the platform sub-module.
the absolute path to the ios Podfile.
if file(s) do not exist.
Function to return the location of the src module containing the common/shared platform code.
the absolute path to the common source code.
if file(s) do not exist.
A representation of the structure of a project made with the Klutter Framework. Each property of this object represents a folder containing one or more folders and/or files wich are in some way used or needed by Klutter.
Gillian Buijs
flutter: plugin: platforms: android: package: com.example.super_awesome pluginClass: SuperAwesomePlugin ios: pluginClass: SuperAwesomePlugin
android:
+ package: com.example.super_awesome
+ pluginClass: SuperAwesomePlugin
+ ios:
+ pluginClass: SuperAwesomePlugin
platforms: android: package: com.example.super_awesome pluginClass: SuperAwesomePlugin ios: pluginClass: SuperAwesomePlugin
plugin: platforms: android: package: com.example.super_awesome pluginClass: SuperAwesomePlugin ios: pluginClass: SuperAwesomePlugin
The Android plugin class name.
The parsed pubspec.yaml file.
Example:
name: ridiculous_plugin
description: A new flutter plugin project.
version: 0.0.1
homepage: www.my_homepage.com
environment:
sdk: ">=2.16.1 <3.0.0"
flutter: ">=2.5.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# This section identifies this Flutter project as a plugin project.
# The 'pluginClass' and Android 'package' identifiers should not ordinarily
# be modified. They are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
platforms:
android:
package: some.company.ridiculous_plugin
pluginClass: RidiculousPlugin
ios:
pluginClass: RidiculousPlugin
assets:
- images/a_dot_burr.jpeg
- images/a_dot_ham.jpeg
The IOS plugin class name.
The supported plugin platforms.
In the context of Klutter this is only iOS and Android.
The plugin content.
Dependencies instance which uses GIT for all dependencies.
The version of Klutter Gradle Executable Tool.
The version of the klutter Pub Plugin.
The version of the klutter-ui Pub Plugin.
Mapper to read/write YAML.
The version of the squint_json Pub Plugin.
Name of the event to execute.
Name of the extension class to be generated.
Example:
Given the value GreetingEvent, will generate the following:
extension GreetingEvent on State {
// Code omitted for brevity...
}
Data Type used to communicate between Flutter and Kotlin.
Name of the method to be generated.
Example:
Given the value getGreeting, will generate the following:
void getGreeting({
// Code omitted for brevity...
}) => doEvent<String>(
// Code omitted for brevity...
);
Main package file which exports all generated widgets.
The MethodChannel value used to communicate.
Name of the event to execute.
Name of the extension class to be generated.
Example:
Given the value GreetingEvent, will generate the following:
extension GreetingEvent on State {
// Code omitted for brevity...
}
Wrapper for all fields to configure code generation for a Flutter Widget.
Name of the method to be generated.
Example:
Given the value getGreeting, will generate the following:
void getGreeting({
// Code omitted for brevity...
}) => doEvent<String>(
// Code omitted for brevity...
);
Type of data (if any) returned after finishing the event.
Type of data (if any) returned after finishing the event.
Example
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:klutter_ui/klutter_ui.dart';
import 'package:hello/src/my_response_dataclass.dart';
const _stream = EventChannel('com.example.hello/stream/my_response_subscriber');
class MyResponseSubscriber extends Subscriber<MyResponse> {
const MyResponseSubscriber({
required Widget Function(MyResponse?) builder,
Key? key,
}) : super(
builder: builder,
channel: _stream,
topic: "my_response_subscriber",
key: key,
);
@override
MyResponse deserialize(String json) => json.toMyResponse;
}
Serialize a pubspec.yaml for a new plugin project.
Create a KlutterPrinter instance which generates a Flutter Producer Widget.
Example
Given input:
channel.name: com.example.awesome.my_awesome_app
event.name: greeting
extension.className: GreetingEvent
request.type: String
response.type: String
method.name: getGreeting
Will generate:
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:klutter_ui/klutter_ui.dart';
const MethodChannel _channel =
MethodChannel('com.example.awesome.my_awesome_app');
extension GreetingEvent on State {
void getGreeting({
required String message,
void Function(String)? onSuccess,
void Function(Exception)? onFailure,
void Function()? onNullValue,
void Function(AdapterResponse<String>)? onComplete,
}) => doEvent<String>(
state: this,
event: "greeting",
message: message,
channel: _channel,
onSuccess: onSuccess,
onFailure: onFailure,
onNullValue: onNullValue,
onComplete: onComplete,
);
}
void getGreeting({
required String message,
State? state,
void Function(String)? onSuccess,
void Function(Exception)? onFailure,
void Function()? onNullValue,
void Function(AdapterResponse<String>)? onComplete,
}) => doEvent<String>(
state: state,
event: "greeting",
message: message,
channel: _channel,
onSuccess: onSuccess,
onFailure: onFailure,
onNullValue: onNullValue,
onComplete: onComplete,
);
Serialize a pubspec.yaml for a new plugin project.
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:klutter_ui/klutter_ui.dart';
import 'package:hello/src/my_response_dataclass.dart';
const _stream = EventChannel('com.example.hello/stream/my_response_subscriber');
class MyResponseSubscriber extends Subscriber<MyResponse> {
const MyResponseSubscriber({
required Widget Function(MyResponse?) builder,
Key? key,
}) : super(
builder: builder,
channel: _stream,
topic: "my_response_subscriber",
key: key,
);
@override
MyResponse deserialize(String json) => json.toMyResponse;
}
Exception class indicating a terminal problem in the Klutter Framework.
Output the content of a (to be created) class.
Class which contains all logic to fully execute a functional task.
Utility interface which takes (generated) file content and writes it to a file.
Used for editing and/or creating classes and configuration files.
Creates a new file and writes the content to said file.