Skip to content

Commit 1ed4ee7

Browse files
committed
Implement _PluginRegistrant.register()
1 parent 0078602 commit 1ed4ee7

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

lib/tizen_plugins.dart

+18-3
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,27 @@ Future<String> _createEntrypoint(
190190
//
191191
// @dart=${languageVersion.major}.${languageVersion.minor}
192192
193+
// ignore_for_file: unused_element
194+
193195
import '$mainImport' as entrypoint;
194196
import 'generated_plugin_registrant.dart';
195197
196-
Future<void> main() async {
197-
registerPlugins();
198-
entrypoint.main();
198+
@pragma('vm:entry-point')
199+
class _PluginRegistrant {
200+
@pragma('vm:entry-point')
201+
static void register() {
202+
registerPlugins();
203+
}
204+
}
205+
206+
typedef _UnaryFunction = dynamic Function(List<String> args);
207+
208+
void main(List<String> args) {
209+
if (entrypoint.main is _UnaryFunction) {
210+
(entrypoint.main as _UnaryFunction)(args);
211+
} else {
212+
entrypoint.main();
213+
}
199214
}
200215
''');
201216
return entrypoint.path;

0 commit comments

Comments
 (0)