nativeDartTemplate function
Implementation
String nativeDartTemplate(String pluginName, String className, String annotation, {bool web = false}) =>
'''
import 'package:nitro/nitro.dart';
${web ? "\nimport '$pluginName.platform.g.dart';\n" : ''}
part '$pluginName.g.dart';
$annotation
abstract class $className extends HybridObject {
${web ? '/// On web, await `ensure${className}Ready()` before first use — the\n /// WASM module loads asynchronously.\n ' : ''}static final $className instance = ${web ? 'create${className}Instance()' : '_${className}Impl()'};
double add(double a, double b);
@nitroAsync
Future<String> getGreeting(String name);
}
''';