From 8ccf8abd99b3b77046fef555aed4cfd7e483ac5b Mon Sep 17 00:00:00 2001 From: dali Date: Sun, 27 Mar 2022 10:18:20 +0100 Subject: [PATCH] feat : add `getGeoPointMarkers` in osm_interface (#237) * add new method `getGeoPointMarkers` in osm_interface * implement `getGeoPointMarkers` in osm_channel --- README.md | 4 ++-- example/pubspec.lock | 2 +- .../lib/src/channel/osm_method_channel.dart | 10 ++++++++-- flutter_osm_interface/lib/src/osm_interface.dart | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d184826..1ccb5808 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # flutter_osm_plugin -![pub](https://img.shields.io/badge/pub-v0.32.1-orange) +![pub](https://img.shields.io/badge/pub-v0.33.0-orange) ## Platform Support @@ -41,7 +41,7 @@ Add the following to your `pubspec.yaml` file: dependencies: - flutter_osm_plugin: ^0.32.2 + flutter_osm_plugin: ^0.33.0 ### Migration to `0.16.0` (Android Only) diff --git a/example/pubspec.lock b/example/pubspec.lock index f9e8a24a..b57e4380 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -89,7 +89,7 @@ packages: path: ".." relative: true source: path - version: "0.32.1" + version: "0.32.2" flutter_plugin_android_lifecycle: dependency: transitive description: diff --git a/flutter_osm_interface/lib/src/channel/osm_method_channel.dart b/flutter_osm_interface/lib/src/channel/osm_method_channel.dart index 539c69a9..080e8792 100644 --- a/flutter_osm_interface/lib/src/channel/osm_method_channel.dart +++ b/flutter_osm_interface/lib/src/channel/osm_method_channel.dart @@ -701,6 +701,12 @@ class MethodChannelOSM extends MobileOSMPlatform { result.map((e) => Map.from(e)).toList(); return mapRoadInfo.map((e) => RoadInfo.fromMap(e)).toList(); } + + @override + Future> getGeoPointMarkers(int idOSM) async { + final list = await _channels[idOSM]!.invokeListMethod("get#geopoints"); + return (list as List).map((e) => GeoPoint.fromMap(e)).toList(); + } } extension config on MethodChannelOSM { @@ -721,10 +727,10 @@ extension config on MethodChannelOSM { await _channels[idOSM]?.invokeMethod('config#Zoom', args); } - Future initIosMap(int idOSM,GlobalKey key) async { + Future initIosMap(int idOSM, GlobalKey key) async { await _channels[idOSM]?.invokeMethod("init#ios#map"); final icon = (await _capturePng(key)).convertToString(); - await _channels[idOSM]?.invokeMethod("setDefaultIOSIcon",icon); + await _channels[idOSM]?.invokeMethod("setDefaultIOSIcon", icon); } } diff --git a/flutter_osm_interface/lib/src/osm_interface.dart b/flutter_osm_interface/lib/src/osm_interface.dart index 88d3bc4c..7254a988 100644 --- a/flutter_osm_interface/lib/src/osm_interface.dart +++ b/flutter_osm_interface/lib/src/osm_interface.dart @@ -283,4 +283,8 @@ abstract class MobileOSMPlatform extends OSMPlatform { Future getBounds( int idOSM, ); + + Future> getGeoPointMarkers( + int idOSM, + ); }