kakao_map_plugin 1.0.0
kakao_map_plugin: ^1.0.0 copied to clipboard
This is a plug-in project made by using the webview_flutter package so that the javascript of Kakao map api can be used on the flutter.
1.0.0 #
Korean translation of this entry: CHANGELOG_KO.md
First stable release. It adds Web support, covers all 77 official Kakao Maps JS samples, and includes the behavior changes listed below. A migration guide is available in the README (README.md in Korean, README_EN.md in English) under "Migrating from 0.x".
⚠️ BREAKING (behavior changes) #
controller.clearMarker()now removes only plain markers and skips markers managed by a clusterer. Migration: callclearMarkerClusterer()as well if you also want to remove clusterer markers.controller.clear()now also removes the clusterer object and its markers (previously the markers could just be hidden while the cluster indicators remained). Migration: if you want to keep the clusterer, call the individualclearXxx()methods instead ofclear().controller.clearMarkerClusterer()releases the clusterer object (null) and removes its markers from the global list. Migration: calladdMarker()again to re-display markers after releasing the clusterer.- Starting a new search of the same kind while a request is still in flight now terminates the previous request's legacy
xxxResult()wait withStateError('새 요청으로 대체되었습니다.')instead of waiting forever. Migration: if you use the legacy static result path, wrap theawaitintry/catch, or use the per-request return value ofcontroller.keywordSearch(). controller.addMarker(markers: [])andKakaoMap(markers: [])now remove all existing plain markers, consistent with the other overlays (previously ignored).nullis still ignored. Migration: passnullinstead of an empty list ([]) to keep existing markers.- Re-adding a marker with the same ID but different content now updates it (previously ignored). Migration: do not re-invoke with the same ID if you want to keep the existing marker.
- Overlays passed as
KakaoMapwidget properties are now drawn automatically when the map is ready (onMapCreated). Migration: remove code that drew those overlays separately in theonMapCreatedcallback so they are not applied twice. - Links (
<a href>) inside info windows and custom overlays are now intercepted and reported throughKakaoMap(onLinkTap:)instead of navigating the WebView away from the map. Migration: handleonLinkTapto open the URL yourself (for example withurl_launcher); the tap is ignored when no callback is provided. - Text selection, tap highlight, the long-press context menu, page pinch-zoom and overscroll are disabled by default in the map document. Migration: add the
kmp-selectableCSS class to elements that must stay selectable. - Added a new dependency on
pointer_interceptor(only used on Web in practice). Migration: runflutter pub get; no code change is required for Android/iOS. - Failed search calls (Kakao API returning an error status, or a
nullresult) now complete theFuturewith an error instead of completing successfully. Migration: wrap search calls intry/catch. Zero results (ZERO_RESULT) is still not an error.
Deprecated (kept, will be removed in 2.0.0) #
Nothing was removed in 1.0.0. All deprecated APIs still work.
MapType.roadMapis@Deprecatedbecause its value is identical toMapType.normal. UseMapType.normal.setStyle()is@Deprecated. Control the container size with Flutter widgets and callrelayout()instead.getDraggable()andgetZoomable()are@Deprecated. UseisDraggable()andisZoomable().- The unused platform template classes
KakaoMapPluginPlatformandMethodChannelKakaoMapPluginare@Deprecated. (KakaoMapPluginWebstays as the Web platform registration class.)
Web support #
- Added support for the web platform. On Web the same HTML is rendered in a same-origin iframe document instead of a WebView. Map, overlay, roadview, Drawing, search and tileset APIs behave the same as on mobile, and no code change is required.
- Added
KakaoMapPointerInterceptor, a widget that wraps Flutter widgets stacked on top of the map (iframe) so they receive taps on Web. On Android/iOS it returns its child unchanged. - You must register the app origin (including the port) under Web platform site domains in the Kakao console. The
baseUrlworkaround does not work on Web. - Dart-to-JS communication is now abstracted behind
KakaoMapBridge(WebViewBridgeon mobile,IframeBridgeon Web). Existing constructors such asKakaoMapController(WebViewController)are unchanged; on Web thewebViewControllergetter throws aStateError.
Performance #
- Overlays (markers, polylines, circles, rectangles, polygons, custom overlays) are sent in a single batch call instead of one call per element. For N markers this cuts bridge round trips from N+1 to 1-3.
didUpdateWidgetnow compares a content signature per overlay kind and re-sends only the kinds that actually changed. Unrelated parent rebuilds no longer recreate every overlay.- Overlay bookkeeping on the JS side moved from linear array scans (O(N^2)) to O(1) lookups through an id index (Map).
- Overlays with the same ID and the same content are reused instead of recreated (per-item hash). Only items whose content changed are replaced.
- Blob URLs and
MarkerImageinstances for base64 marker icons are cached and released withrevokeObjectURLondispose().MarkerIcon.fromAssetresults are cached by asset name. - The
dblclicklistener is not registered when noonMapDoubleTapcallback is set. relayout()calls are coalesced, removing the duplicate map reflow that happened on every widget rebuild. It is still applied immediately right after the map is ready and when the widget size changes.- The SDK extension libraries to load can now be selected. Excluding unused libraries reduces download and parse cost at map creation (for example the
drawingbundle is about 99KB uncompressed, comparable to the map core). The default is all libraries, so behavior is unchanged if you do not specify any.
Bug fixes #
- Fixed polylines, circles, rectangles and polygons not receiving a JS-side
id, which made ID-based partial updates andclearXxx(ids:)always delete everything. - Fixed coordinate or property changes on an existing
markerIdnot being reflected on the map. - Fixed
setMarkerDraggablenot always working (markerIdproperty name mismatch). - Fixed
Clusterer.disableClickZoombeing ignored and always behaving astrue. - Fixed the clusterer absorbing plain markers and accumulating previous markers on recreation. Clusterer markers and plain markers are now managed separately.
- Fixed clusterer creation failing when
ClustererStyle.colororbackgroundwas null. - Fixed
strokeStylebeing ignored on polygons with holes (holes). - Fixed
LatLng.fromJsonthrowing aTypeErrorfor integer coordinates, andLatLngBounds.fromJsonalways failing. - Fixed a
TypeErrorfromgetBounds()andgetLevel()when they returned integer coordinates. - Fixed broken JS syntax (and a possible injection) when a search term or content contained single quotes, newlines, U+2028 and similar characters. All values are now passed safely as JSON string literals.
- Blocked HTML/JS injection through custom overlay IDs.
- Fixed initial overlays passed as widget properties not being drawn until the first rebuild. They are now drawn at
onMapCreated. - Fixed existing overlays not being restored when the WebView page reloads. (Note: on iOS a document loaded with
loadHtmlStringdoes not re-execute its HTML onreload()due to WKWebView behavior, so it is not restored. Recreate the widget to redraw the map.) - Fixed one failing overlay in a batch preventing the remaining overlays from being displayed.
- Fixed existing overlays staying on the map when an overlay list such as
markerswas changed tonull. - Fixed
setBounds()always failing (added an optionalboundsparameter). - Fixed Android WebView remote debugging being enabled in release builds (now enabled only under
kDebugMode). - Fixed
ClustererStyle.backgroundbeing passed to CSS as a Flutter-ordered hex value (#aarrggbb), which produced the wrong color. It is now passed in CSS form (#rrggbb/rgba()). - Fixed
KeywordSearchRequest.useMapCenteranduseMapBoundsalways being ignored (Placesis now bound to the map). - Fixed marker text being inserted unescaped into the initial
KakaoStaticMapHTML, which broke the script when the text contained</script>.
Search service #
- Introduced request-ID based routing for keyword, category, address and coordinate conversion requests. Concurrent requests each receive their own response, and the
Futurecompletes with an error when the Kakao API returns an error status (previously it waited forever). Requests without a response within 60 seconds complete with aTimeoutException. - Fixed search failures (Kakao API returning an
ERRORstatus, or anullresult) being treated as success. Note that zero results (ZERO_RESULT) is not an error and yields an empty list, matching the previous behavior. - Fixed
AddressSearchRequest.analyzeTypebeing ignored when sending the request. - Fixed the legacy
xxxResult()callback path not being terminated when a search request timed out (it is now terminated together with the request). - When the map was created without the
serviceslibrary, search API calls now complete with aSERVICES_LIBRARY_NOT_LOADEDerror instead of silently hanging.
Native app feel (defaults) #
- The map document now uses system fonts (
-apple-system, Roboto, Noto Sans KR, ...) by default, and disables tap highlight, text selection, the long-press callout/context menu, page pinch-zoom, overscroll glow/bounce, scrollbars and focus rings. Add thekmp-selectableclass to elements that must stay selectable. Link previews are also disabled on iOS. - Fixed tapping an
<a href>inside an info window or custom overlay navigating the WebView away and making the map disappear. Navigation is intercepted and reported throughKakaoMap(onLinkTap:)(the roadview widgets behave the same). The tap is ignored when no callback is set.
App-feel package #
- Added
InfoWindowStyle. Set it throughMarker.infoWindowStyleorKakaoMapTheme.infoWindowStyleto draw an app-style bubble (rounded corners, shadow, tail, close button) instead of the SDK default info window.material(),cupertino()anddark()presets are available; the shape is unchanged when not specified. - Added
KakaoMapTheme(AuthRepository.initialize(theme:)globally,KakaoMap(theme:)per map) to set the font, the background color shown before tiles load, the default info window style, and extra CSS. - Added
KakaoMapControls(Flutter zoom in/out and map type buttons) andKakaoDrawingToolbar(a chip bar for Drawing shape selection and undo). Both useKakaoMapPointerInterceptorinternally so they remain tappable on Web. - Added
MarkerIcon.pin(color:)(an SVG pin recolored on the fly) andMarkerIcon.fromWidget()(renders a Flutter widget into a marker image). - Added the
ClustererStyle.material(color)preset and thefontSize,fontWeight,fontFamily,border,boxShadowandopacityfields. - Added
KakaoMap(copyrightPosition:, copyrightReversed:)andKakaoRoadMap/KakaoMapRoadviewView(disableZoomControl:).
Overlay events / markers / Flutter widget overlays / search pagination / Kakao Map links #
- Added
KakaoMapWidgetOverlayandKakaoMap(widgetOverlays:). They attach real Flutter widgets to map coordinates and follow the pixel positions reported by JS as the map moves (once per frame). They are tappable on Web too. - Added the tap callbacks
onPolylineTap,onCircleTapandonRectangleTap, plusonMapLongPress(which includes right-click in mouse environments). - Added the mouse hover callbacks
onMarkerMouseOver,onMarkerMouseOut,onPolygonMouseOver,onPolygonMouseMove,onPolygonMouseOutandsupportsHover(). These are mouse-pointer environments only and are never called on touch devices. The examples "마커에 마우스 이벤트 등록하기" (registering mouse events on a marker) and "다각형에 이벤트 등록하기 1 / 2" (registering events on a polygon) were restored to match the official samples, with a touch fallback added. - Added
opacity,visible,clickable,titleand sprite support (spriteOrigin,spriteWidth,spriteHeight) toMarker, plussetMarkerPosition()(moves without recreating),setMarkerVisible(),showInfoWindow()andhideInfoWindow(). - Added
paginationto keyword, category and address search responses (SearchPagination:totalCount,current,hasNextPage,hasPrevPage). - Added
KakaoMapLinks, which builds place, directions, roadview and search URLs as Kakao Map web links (map.kakao.com/link/...) and app schemes (kakaomap://). Launch them yourself withurl_launcheror similar.
Camera / measurement #
- Fixed
KakaoMap(minLevel:, maxLevel:)not being applied when changed by a rebuild, and addedsetMinLevel()andsetMaxLevel(). - Added
jump(center, level, animate:, duration:),panBy(dx, dy),panToBounds(bounds, padding:)andfitBounds(points, padding:). - Added
getPolylineLength(),getPolygonArea()andgetPolygonLength(), which return the SDK-computed values. The examples "선의 거리 계산하기" (calculating the distance of a line) and "다각형의 면적 계산하기" (calculating the area of a polygon) now behave like the official samples. - Added the map creation options
mapTypeId(initial map type),disableDoubleClick,disableDoubleClickZoom,scrollwheelandkeyboardShortcuts, plus theonMapTypeChangedcallback.
Roadview #
- Fixed
KakaoRoadMapnot callingonMapCreated, not drawing markers, and duplicating markers indefinitely on every rebuild. - Fixed the roadview turning into a blank screen on iOS after returning from the background (uses
relayout()instead ofreload()). - The
onRoadviewNotFoundcallback is now invoked without an error in areas that have no roadview (panoId === null). - Added
KakaoRoadviewController(delivered throughonRoadviewCreated). It providessetPanoId,setPanoIdNear,getPanoId,setViewpoint,getViewpoint,getPosition,viewpointFromCoords,relayout,addMarker,addCustomOverlay,clearMarker,clearCustomOverlayandclear. - Added
panoId,radius,viewpointandcustomOverlaystoKakaoRoadMap, plus the callbacksonRoadviewInit,onPanoIdChange,onViewpointChange,onPositionChange,onRoadviewNotFound,onMarkerTapandonCustomOverlayTap. The existingonMapCreatedandcurrentLevelare unchanged. - Added the
Viewpointmodel (pan,tilt,zoom). - Added
altitudeandrangetoMarker, andaltitudetoCustomOverlay(used in roadview). - Fixed the MapWalker sprite coordinates being wrong, which made the icon look cropped (now uses the official Kakao sample coordinates).
- Fixed the map center being off by half the viewport in
KakaoMapRoadviewViewafter switching display mode or resizing. Entering split or roadview mode for the first time now loads the roadview at the map center automatically. - Added
KakaoMapRoadviewView/KakaoMapRoadviewController/RoadviewViewMode, which show a map and a roadview together in one WebView. Clicking the map moves the roadview, and the MapWalker indicates the roadview viewpoint direction on the map.
Overlay interaction #
- Added the
KakaoMap(onPolygonTap:)polygon tap callback. - Added
CustomOverlay.removable(close button plus theonCustomOverlayRemovecallback) andCustomOverlay.draggable(drag plus theonCustomOverlayDragEndcallback). Map panning is locked while dragging, and document-level listeners are removed as soon as the drag ends. - Fixed
coordToPixelandpixelToCoordthrowing an opaque cast error when called after the map was disposed. They now throw aStateErrorthat explains the cause.
Drawing Library #
- Added bindings for the Drawing Library, which lets users draw shapes on the map:
KakaoMapController.createDrawingManager,selectDrawingMode,cancelDrawing,undoDrawing,redoDrawing,removeDrawingShape,getDrawingData,showDrawingToolbox,removeDrawingToolbox. - Added
DrawingOverlayType,DrawingOptions,DrawingStyleand the result DTOsDrawingData/ theDrawingShapefamily (DrawingMarkerShape,DrawingPathShape,DrawingRectangleShape,DrawingCircleShape,DrawingEllipseShape). Coordinates are normalized toLatLng. - Added the
KakaoMapcallbacksonDrawingEnd,onDrawingRemoveandonDrawingStateChange. - When the map is created without
KakaoMapLibrary.drawing, the Drawing APIs are silently ignored and the error is recorded inwindow.__kakaoMapErrors.
Custom tileset #
- Added
Tileset/TilesetCopyrightandKakaoMapController.addTileset,setTileset,addOverlayTileset,removeOverlayTileset,getActiveTilesetId. The tile source can be a URL template ({x},{y},{z}), a URL function, or a DOM tile function. getMapTypeId()now returnsMapType.normalwithout throwing while a custom tileset is the base map type. UsegetActiveTilesetId()to read the tileset ID.
New APIs (backward compatible) #
- Added the
KakaoMapLibraryenum withAuthRepository.initialize(libraries:)andKakaoMap(libraries:). All libraries are loaded when unspecified, as before, andclustereris included automatically when used. - Added the synchronous
MarkerIcon.network(url)constructor. The existingMarkerIcon.fromNetworkstill returns aFuture<MarkerIcon>. - Added
MarkerIcon.fromBytes(bytes)andMarkerIcon.fromBase64(base64). - The image is sent to the WebView only once even when several markers use the same base64 icon (
registerImagesregistry). - Added
BaseService.createRequest(),requestFuture(),failRequest()andhandleMessage(). The existingresetCompleter(),completerandxxxCallbackare kept. - Added
AuthRepository.isInitialized; accessingappKeybefore initialization now throws a clearStateError. TheappKeysetter is kept. - Added an optional
boundsparameter tosetBounds(). - Added
isDraggable()andisZoomable(). The existinggetDraggable()andgetZoomable()still work.
Examples #
- All 77 official Kakao samples can now be run from the example app. Added 9 roadview screens, 12 overlay screens, 4 Drawing screens and 2 custom tileset screens. (Marker mouseover/mouseout is replaced by an informational screen because mobile has no hover concept.)
- Cleaned up duplicated library example file numbers (three
library_11_*files).
Docs #
- Documented that the
idsargument ofclearXxx(ids:)(for exampleclearMarker(markerIds:)) is the list of IDs to keep (no behavior change).
Misc #
- Added the
pointer_interceptordependency for Web support (no effect on mobile behavior). - Removed the
dart:iodependency. - Applied
flutter_lintsto strengthen the static analysis rules.
0.4.0 #
- BREAKING: Minimum SDK version updated to Dart 3.3.0 and Flutter 3.19.0.
- Migrated from deprecated
dart:htmltopackage:webfor web platform support. - Improved static analysis score for pub.dev.
- Removed unused variables and imports.
- Updated Kotlin version to 2.1.0 for Android.
- Cleaned up example app by removing internal test screens.
0.3.7 #
- Changed the parameter order of coord2Address and coord2RegionCode.
- Update the example to display the marker at the clicked location.
0.3.6 #
- Add marker image loading from assets.
0.3.5 #
- Optimize drawing performance
- Removed "isClickable" option from custom overlay.
0.3.4 #
- Modify to retrieve the list of markers for the selected cluster.
0.3.3 #
- Modify code to be depreciated.
- The package related to webview has been updated.
- fix onBoundsChanged is not working on android device.
0.3.2 #
- added dispose method.
- apply dart format.
0.3.1 #
- Modified the parameters for coord2RegionCode and coord2Address.
0.3.0 #
- Integration and implementation of an example for searching places by keyword
- Integration and implementation of an example for displaying a list of places searched by keyword
- Integration and implementation of an example for searching places by category
- Integration and implementation of an example for searching places by specific categories
- Integration and implementation of an example for displaying places by address
- Integration and implementation of an example for obtaining an address by coordinates
- Integration and implementation of an example for converting WTM coordinates to WGS84 coordinates
- Modification of the example source for marker clustering
- Addition of options when using setLevel
0.2.6 #
- Modified the street view to allow dynamic setting of central coordinates.
- Added zIndex properties for polyline, polygon, circle, and rectangle.
- Changed the location of the addJavaScriptChannels code.
- Fixed a missing > tag in div element for addCustomOverlay.
0.2.5 #
- Modify the hard-coded style in the Polyline drawing.
0.2.4 #
- Modified CustomOverlay click event
0.2.3 #
- Added Marker Clusterer
0.2.2 #
- Changed the default value of the image marker's offset.
0.2.1 #
- Modified to accept xAnchor, yAnchor, and zIndex as parameters.
0.2.0 #
- Fixed bugs in getLevel and getMapTypeId.
0.1.9 #
- Adjusted the timing of the 'addJavaScriptChannels' invocation
0.1.8 #
- Changed the timing of setting map for CustomOverlay
0.1.7 #
- Added CustomOverlay click event
0.1.4 #
- Added callbacks to detect the drag start and end events of a marker
0.1.3 #
- Add the "isClickable" option to the CustomOverlay creation.
0.1.2 #
- Added Dart document comments
- Added "generated" folder to .gitignore
0.1.1 #
- Changed ControlPosition enum variables from upper camel case to lower camel case
- Updated webview_flutter package to the latest version
- Added webview_flutter_android and webview_flutter_wkwebview
- Migrated to the new version of webview_flutter package
0.1.0 #
- Implemented and added a sample for loading views
- Added drawing rectangles functionality
- Changed onMarkerClick to onMarkerTap
0.0.1 #
- Initial release.