Skip to content

Commit ce3caa9

Browse files
committed
flutter plugins - remove deprecated APIs
closes #147
1 parent a6a8376 commit ce3caa9

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import io.flutter.plugin.common.MethodChannel;
88
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
99
import io.flutter.plugin.common.MethodChannel.Result;
10-
import io.flutter.plugin.common.PluginRegistry.Registrar;
1110

1211
/** ObjectBoxFlutterPlugin */
1312
public 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")) {

sync_flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import io.flutter.plugin.common.MethodChannel;
88
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
99
import io.flutter.plugin.common.MethodChannel.Result;
10-
import io.flutter.plugin.common.PluginRegistry.Registrar;
1110

1211
/** ObjectBoxFlutterPlugin */
1312
public 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

Comments
 (0)