Skip to content

Commit 89f91be

Browse files
[native_doc_dartifier] Add an example in the "translate prompt" on how to translate "implementing an interface" (#2473)
1 parent dfd5857 commit 89f91be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkgs/native_doc_dartifier/lib/src/prompts.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ JNIgen handles various syntactic and semantic differences between Java/Kotlin an
7676
* Pass each interface method as a named closure argument within the `\$InterfaceName` factory constructor.
7777
* Example: `InterfaceName.implement(\$InterfaceName(method1: (param1) { /* ... */ }))`
7878
* **Reusable Implementations:**
79-
* If the Java/Kotlin code defines a class that `implements` an interface, To translate it to Dart make this class to be 'final class with' \$InterfaceName, as JNIgen make a mixin class \$InterfaceName that handles this, Don't make it to implements InterfaceName only use the mixin class.
79+
* If the Java/Kotlin code defines a class that `implements` an interface, To translate it to Dart make this class to be 'final class with', Don't make it to implements InterfaceName only use the mixin class.
80+
* Example: `public class MyClass implements Comparable` becomes `final class MyClass with \$Comparable`.
8081
* **Asynchronous Listener Methods:**
8182
* For `void`-returning methods in implemented interfaces that should be non-blocking (listeners), explicitly set the `<methodName>\$async` parameter to `true` when using the inline implementation (e.g., `run\$async: true`).
8283
* If using a reusable class (mixin), override the `<methodName>\$async` getter to return `true` (e.g., `bool get run\$async => true;`).

0 commit comments

Comments
 (0)