Open
Description
Currently we can add a custom method to an existing JNIgen generated class, however the experience is clunky. We might want to use other Java classes, that exist in different packages, hardcoding all this can be flaky, we would like to write our custom code in a templating language that allows us to reference other Java types, methods, fields, ... These references will be replaced at the generation time with the correct values after all the renaming is done. They also add the necessary import
statements to import these types.
An example syntax of such language:
r'''
@{{dart:core/override}}
@{{dart:core/StackTrace}} get stackTrace {
final stringWriter = {{java.io.StringWriter}}();
{{java.lang.Throwable#printStackTrace(Ljava.io.PrintWriter;)V}}(stringWriter);
final stackTrace = @{{dart:core/StackTrace}}.fromString(
stringWriter.toString().toDartString(releaseOriginal: true),
);
stringWriter.release();
return stackTrace;
}
'''
Metadata
Metadata
Assignees
Type
Projects
Status
No status