77import io .flutter .plugin .common .MethodChannel ;
88import io .flutter .plugin .common .MethodChannel .MethodCallHandler ;
99import io .flutter .plugin .common .MethodChannel .Result ;
10- import io .flutter .plugin .common .PluginRegistry .Registrar ;
1110
1211/** ObjectBoxFlutterPlugin */
1312public class ObjectBoxFlutterPlugin implements FlutterPlugin , MethodCallHandler {
@@ -19,24 +18,10 @@ public class ObjectBoxFlutterPlugin implements FlutterPlugin, MethodCallHandler
1918
2019 @ Override
2120 public void onAttachedToEngine (@ NonNull FlutterPluginBinding flutterPluginBinding ) {
22- channel = new MethodChannel (flutterPluginBinding .getFlutterEngine (). getDartExecutor (), "objectbox" );
21+ channel = new MethodChannel (flutterPluginBinding .getBinaryMessenger (), "objectbox" );
2322 channel .setMethodCallHandler (this );
2423 }
2524
26- // This static function is optional and equivalent to onAttachedToEngine. It supports the old
27- // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
28- // plugin registration via this function while apps migrate to use the new Android APIs
29- // post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
30- //
31- // It is encouraged to share logic between onAttachedToEngine and registerWith to keep
32- // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
33- // depending on the user's project. onAttachedToEngine or registerWith must both be defined
34- // in the same class.
35- public static void registerWith (Registrar registrar ) {
36- final MethodChannel channel = new MethodChannel (registrar .messenger (), "objectbox" );
37- channel .setMethodCallHandler (new ObjectBoxFlutterPlugin ());
38- }
39-
4025 @ Override
4126 public void onMethodCall (@ NonNull MethodCall call , @ NonNull Result result ) {
4227 if (call .method .equals ("getPlatformVersion" )) {
0 commit comments