From 4f3195bb96af755fc876f74ceea2348720867da6 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 17 Jul 2024 16:02:38 +0900 Subject: [PATCH] Fix return type num to double --- .../lib/src/google_maps_controller.dart | 11 ++++++----- .../lib/src/google_maps_flutter_tizen.dart | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index c7f064c69..0a78887d4 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -488,9 +488,10 @@ class GoogleMapsController { 'JSON.stringify(map.$method.apply(map, $args))'); } - Future _getZoom(WebViewController controller) async { + Future _getZoom(WebViewController controller) async { try { - return await _callMethod(controller, 'getZoom', []) as num; + return (await _callMethod(controller, 'getZoom', []) as num) + + 0.0; } catch (e) { debugPrint('JavaScript Error: $e'); return 0.0; @@ -592,7 +593,7 @@ class GoogleMapsController { JSON.stringify(getPixelToLatLng()); '''; - return controller.runJavaScriptReturningResult(command) as String; + return await controller.runJavaScriptReturningResult(command) as String; } Future _latLngToPoint(LatLng latLng) async { @@ -612,11 +613,11 @@ class GoogleMapsController { JSON.stringify(getLatLngToPixel()); '''; - return controller.runJavaScriptReturningResult(command) as String; + return await controller.runJavaScriptReturningResult(command) as String; } /// Returns the zoom level of the current viewport. - Future getZoomLevel() async { + Future getZoomLevel() async { return _getZoom(controller); } diff --git a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart index 406aee8a1..71829f643 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart @@ -213,7 +213,7 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { Future getZoomLevel({ required int mapId, }) { - return _map(mapId).getZoomLevel() as Future; + return _map(mapId).getZoomLevel(); } // The following are the 11 possible streams of data from the native side