Skip to content

Commit

Permalink
Implement _PluginRegistrant.register()
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Jul 22, 2021
1 parent 0078602 commit 1ed4ee7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/tizen_plugins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,27 @@ Future<String> _createEntrypoint(
//
// @dart=${languageVersion.major}.${languageVersion.minor}
// ignore_for_file: unused_element
import '$mainImport' as entrypoint;
import 'generated_plugin_registrant.dart';
Future<void> main() async {
registerPlugins();
entrypoint.main();
@pragma('vm:entry-point')
class _PluginRegistrant {
@pragma('vm:entry-point')
static void register() {
registerPlugins();
}
}
typedef _UnaryFunction = dynamic Function(List<String> args);
void main(List<String> args) {
if (entrypoint.main is _UnaryFunction) {
(entrypoint.main as _UnaryFunction)(args);
} else {
entrypoint.main();
}
}
''');
return entrypoint.path;
Expand Down

0 comments on commit 1ed4ee7

Please sign in to comment.