diff --git a/maplibre_gl/android/src/main/java/org/maplibre/maplibregl/GlobalMethodHandler.java b/maplibre_gl/android/src/main/java/org/maplibre/maplibregl/GlobalMethodHandler.java index 8817c883..a58eed0a 100644 --- a/maplibre_gl/android/src/main/java/org/maplibre/maplibregl/GlobalMethodHandler.java +++ b/maplibre_gl/android/src/main/java/org/maplibre/maplibregl/GlobalMethodHandler.java @@ -79,13 +79,8 @@ public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { result.success(null); break; case "setOffline": - boolean offline = methodCall.argument("offline"); - ConnectivityReceiver.instance(context).setConnected(offline ? false : null); - result.success(null); - break; - case "setConnected": - boolean connected = methodCall.argument("connected"); - ConnectivityReceiver.instance(context).setConnected(connected ? true : null); + Boolean offline = (Boolean) methodCall.argument("offline"); + ConnectivityReceiver.instance(context).setConnected(offline!=null ? !(offline) : null); result.success(null); break; case "mergeOfflineRegions": diff --git a/maplibre_gl/lib/src/global.dart b/maplibre_gl/lib/src/global.dart index 87ef38db..c6ed4e14 100644 --- a/maplibre_gl/lib/src/global.dart +++ b/maplibre_gl/lib/src/global.dart @@ -19,20 +19,13 @@ Future installOfflineMapTiles(String tilesDb) async { enum DragEventType { start, drag, end } -Future setOffline(bool offline) => _globalChannel.invokeMethod( +Future setOffline(bool? offline) => _globalChannel.invokeMethod( 'setOffline', { 'offline': offline, }, ); -Future setConnected(bool connected) => _globalChannel.invokeMethod( - 'setConnected', - { - 'connected': connected, - }, -); - Future setHttpHeaders(Map headers) { return _globalChannel.invokeMethod( 'setHttpHeaders',