sharemap_maplib_flutter library

Classes

ActionResult
Kết quả thực thi một action (§7).
AdoptedStamp
«Người dùng đã chọn» — ai, lúc nào (component_memory_sync.md 4, 13.6): meta.adopted của bản ghi, đi cùng doc đồng bộ. Không có = AI vẽ, chưa ai chọn (hay chọn trên máy chưa bật đồng bộ).
AgentChatController
AgentErrorEvent
Phát thêm, không thay cho agent:tool-result/agent:turn-end, để timeline có một mục đỏ rõ ràng mà không phải mở payload ra soi.
AgentLlmRequestEvent
AgentLlmResponseEvent
AgentServices
AgentSession
Khối session của 2 (§3.6): agent ở xa cấp id ở lượt đầu; client chỉ giữ và gửi lại. historyMessages = số message agent đã nhớ trước lượt này — 0 khi client đang hiển thị hội thoại nghĩa là phiên cũ đã hết hạn.
AgentStep
AgentToolResultEvent
AgentToolStartEvent
AgentTurnEndEvent
AgentTurnResult
AgentTurnStartEvent
AiShareMapAgent
AiShareMapAgentOptions
AiShareMapRemote
AndroidMapView
How the map is drawn on Android. Ignored on iOS and web.
AnimationPath
Đường animation chạy: toạ độ + quãng đường cộng dồn (mét) tới từng đỉnh.
Annotation
Base interface for all data-driven map annotations drawn via style layers (symbols, lines, fills, circles, etc.).
AnnotationManager<T extends Annotation>
Manages a homogeneous set of Annotations (e.g. symbols, lines, fills) by owning their backing style source(s)/layer(s) and performing efficient batched updates.
ArgumentCallbacks<T>
Mutable collection of ArgumentCallback instances, itself an ArgumentCallback.
AssistantMessage
AttachDebugConsoleOptions
BackgroundLayerProperties
BadgeRowImage
Hàng huy hiệu số giữa phía trên icon marker (route 1.2, route.md 7.2): số + màu nền theo thứ tự trong hàng, và token route.default.stop.badge. Ảnh có lề kBadgePad mỗi phía cho bóng; neo bottom.
BadgeStyle
Huy hiệu số (route 1.2, route.md 7.2 "Huy hiệu số") trên marker điểm dừng có icon / được tham chiếu: hàng giữa phía trên hộp icon, đáy hàng cách mép trên icon iconGapPx (không đè lên marker); nền = màu điểm dừng của route. Token route.default.stop.badge — theme không khai (theme riêng cũ) hay khai thiếu khoá thì lấy số đo sharemap (fallback).
BuildingDto
BuildingsDto
CameraContext
L0 — camera (§4.1). Luôn có mặt.
CameraDto
CameraLimits
camera.limits — trần zoom / vùng của app (0.1.0: meta.constraints).
CameraPosition
The position of the map "camera", the view point from which the world is shown in the map view. Aggregates the camera's target geographical location, its zoom level, tilt angle, and bearing.
CameraTargetBounds
Bounds for the map camera target. Used with MapLibreMapOptions to wrap a LatLngBounds value. This allows distinguishing between specifying an unbounded target (null LatLngBounds) from not specifying anything (null CameraTargetBounds).
CameraUpdate
Defines a camera move, supporting absolute moves as well as moves relative the current position.
CancelToken
Token huỷ — thay AbortController của web (§9.3 concurrency).
ChatBubble
Một bong bóng chat để render.
ChatMessage
Một lượt trong transcript. sealed để switch trên nó là vét cạn.
Circle
CircleLayerProperties
CircleManager
CircleOptions
Configuration options for Circle instances.
CitationTarget
Đích của một citation trên bản đồ hiện tại.
ClientInfoSource
Nguồn cấp SharemapClientInfo. Trả null nếu nền tảng không áp dụng.
ColorReliefLayerProperties
CommandBuilderOptions
Each call gets a fresh request id unless the caller explicitly supplies one. Reusing responseTo would cause the engine's idempotency cache to skip updates.
ComponentActionError
Lỗi Pha A của một action component. Một action có thể sai ở nhiều phần tử — errors liệt kê mọi chỗ sai ($defs/ErrorDetail, ≤ 10), còn code/message/path/repair là lỗi đầu tiên (§7).
ComponentActionRef
Một action component.* trong batch, kèm vị trí của nó ở actions[].
ComponentEngine
Engine component — đăng ký bằng engine.registerComponentHandler(...) (widget ShareMapLibre tự đăng ký).
ComponentEntry
Một component trong sổ.
ComponentEntryState
Trạng thái do người dùng / engine đổi, không nằm trong cấu hình (4.8).
ComponentEvent
ComponentHandler
Engine component (phase 2) cắm vào ShareMapEngine qua ShareMapEngine.registerComponentHandler.
ComponentHost
Thứ engine cho handler mượn — handler không giữ tham chiếu tới cả engine.
ComponentInventory
L1 — component (§4.2). Engine component (phase 2) cấp qua ComponentHandler.inventory(); chưa có handler thì rỗng.
ComponentLimits
Trần của chương 12.
ComponentMapCall
Lời gọi MapLibre engine component vừa làm (đếm cho kiểm nghĩa vụ 10.10).
ComponentMemory
ComponentMentionCandidate
Một ứng viên của popover @.
ComponentMentionStrings
Chữ tự đặt của @mention theo locale — vi/en mặc định y hệt widget sharemap-agent-chat (mentionRouteDay, mentionRouteAtoB, mentionDay, mentionPlanSub, mentionKm). App dùng hệ i18n riêng thì dựng bản khác.
ComponentOutcome
Kết cục Pha B của một action component.
ComponentPopupController
Danh sách popup đang hiện + kênh ngược từ widget về engine.
ComponentPopupLayer
ComponentPopupView
Một popup đang hiện trên bản đồ.
ComponentQuery
Bộ lọc của ComponentMemory.list (= bộ chọn của get).
ComponentRasterizer
ComponentReference
Một component người dùng @mention — một mục của payload.references (component-mentions-design §3.2). Bốn loại: MarkerReference, PopupReference, RouteReference, TripPlanReference.
ComponentSyncBinding
Transport đổi identity (map khác) → dừng sync cũ (gỡ component của map cũ) rồi gắn sync mới; cùng engine + cùng transport → không làm gì.
ComponentSyncEngine
Phần engine bộ máy cần — ComponentEngine hiện thực; test có thể giả.
ComponentSyncHost
Thứ có sync(transport) — ComponentEngine hiện thực.
ComponentSyncTransport
Transport của bộ máy đồng bộ (mục 8). Cùng hợp đồng với bản web.
ComponentTheme
Một theme đã nạp và gộp — bất biến. Đọc token qua styleOf (đã gộp default ← presets[preset]), tên preset qua presetNames, gói cho AI qua capability.
DebugBus
DebugEvent
DebugEventSummary
DebugOverlay
DebugPanel
DebugPayload
Một khối JSON đáng xem của event.
DetectedTrajectory
DotImage
DownloadRegionStatus
EmojiImage
EngineActionEvent
EngineCapabilities
capabilities engine công bố (§3.1) — chỉ những gì nó thật sự làm được (§9.10 #1: khai thừa là lỗi nặng nhất).
EngineCommandEvent
EngineIdleEvent
EngineMapCallEvent
Trace việc thực thi lên bản đồ — event giá trị nhất của module này.
EngineResultEvent
Error
The end of a download that did not complete. cause says why, with the same code on Android and iOS:
ErrorCodes
Mã lỗi máy đọc được (§7.2).
Expressions
FallbackLlmClient
Bọc nhiều LlmClient, thử lần lượt tới khi một cái chạy được (vd: on-device → cloud). Port của FallbackLLMClient.ts.
FeatureSelection
meta.selections[] — feature người dùng đang chọn (mới nhất ở cuối).
Fill
FillExtrusionLayerProperties
FillLayerProperties
FillManager
FillOptions
Configuration options for Fill instances.
FirstFixFlight
Quyết định bay tới vị trí người dùng (LocateUserOptions.flyTo, sharemap-engine.md 12d): lần có vị trí đầu tiên thì bay, một lần mỗi bản đồ — trừ khi camera đã rời chỗ ban đầu; người dùng bấm nút vị trí lúc chưa có vị trí (forceNext) thì có là bay, bất kể camera.
FleetCommandIds
FleetSnapshotTracker
Stateful adapter for polled snapshots. Metadata/selection updates retain the active segment; only a new GPS coordinate starts a new animation.
GeofencingCircle
Lightweight data class for geofencing circles. Replaces google_maps_flutter Circle with a plain data holder that works with MapLibre's LatLng.
GeojsonSourceProperties
GeolocatorUserLocationPlatform
GeomeshClient
HTTP client mỏng cho các service Geomesh (route/geocode/places…).
GeomeshRequestEvent
GeomeshResponseEvent
GlyphDef
GlyphIcon
Icon glyph marker 1.3 (tròn nền màu + vòng trong + glyph trắng) cho danh sách place, thẻ, panel… — cùng hình học với ảnh engine vẽ trên bản đồ (paintGlyphIcon), vẽ vector bằng CustomPainter nên nét theo đúng mật độ điểm ảnh của màn hình, không nhòe ở ×2 / ×3.
GlyphIconPainter
CustomPainter của GlyphIcon — vẽ vừa hình vuông nhỏ nhất của khung, căn giữa.
GlyphImage
Chấm tròn của icon { color } (6.2, theme doc 3.1 dot): đường kính sizePx tô color, viền ngoài borderColor rộng borderWidthPx (0 = không viền). Neo center. Có text (pinText ≤ 2 ký tự) là chấm có số (marker 1.1): chữ đậm 700 màu textColor ở tâm, cỡ 0.55 × sizePx (1 ký tự) / 0.46 × sizePx (2 ký tự). Tròn nền màu + glyph trắng (marker 1.3 icon { glyph }): Ø diameter, màu nền color (khai / màu loại / màu theo id), token style sau preset. Vẽ vector (path của bộ glyph) ở pixelRatio — không nhòe.
GlyphShape
Một nét của glyph: fill / stroke; tone fg = màu glyph (trắng), bg = nét khoét — tô bằng màu nền đang dùng.
GlyphStyle
Token marker.default.glyph (theme doc 3.1).
HeatmapLayerProperties
HillshadeLayerProperties
HistoryTrajectoryCommandDto
HttpGeomeshClient
ImageDto
ImageRequest
ImageSource
Nguồn của một ảnh engine phải vẽ.
ImageSourceProperties
An image drawn from a url over four corners of the map. For image bytes, use MapLibreMapController.addImageSource.
InMemoryMapAgentSessionStorage
Mặc định: chỉ giữ trong bộ nhớ của runtime.
InMemoryMemoryStore
Store mặc định — chỉ nằm trong RAM. App muốn bền qua lần mở lại thì cắm store riêng (SharedPreferences/file) để package không phải phụ thuộc chúng.
InProgress
InterpolatedPoint
Kết quả nội suy một điểm dọc polyline.
Itinerary
Lịch trình đang hiện trên bản đồ.
ItineraryStop
Một điểm dừng của lịch trình.
JsonCommandBatch
Gói lệnh AI → Client (§5.1 protocol).
JsonResult
Gói kết quả Client → AI (chiều 3, §7).
JsonSchemaValidator
LatLng
A pair of latitude and longitude coordinates, stored as degrees.
LatLngBounds
A latitude/longitude aligned rectangle.
LatLngQuad
A geographical area representing a non-aligned quadrilateral This class does not wrap values to the world bounds
LayerContextItem
L1 — một mục layer.items (§4.4).
LayerDigest
L2 — digest của một layer đang render (§4.6). Không geometry.
LayerLoader
Helper utility to dynamically load map styles and inject authorization.
LayerProperties
LegChipImage
Thẻ chip chữ của chú thích chặng: viên thuốc heightPx, rộng max(minWidthPx, chữ + 2·paddingXPx). Ảnh có lề trong suốt towardIconPx về phía icon (dưới chip khi side top, trên khi bottom) và sideClearPx bên phải (đoạn neo dọc — chip dạt trái): neo ảnh (bottom / top / bottom-right / top-right) đặt đúng tâm icon, không cần icon-offset theo feature. borderColor null = không viền.
LegIconImage
Huy hiệu tròn phương tiện của chú thích chặng (route.md 7.2 "Chặng và chú thích chặng"): tròn Ø sizePx (đã tính viền), glyph trắng glyphRatio × Ø, xoay rotateDeg (độ, đã làm tròn — nướng vào ảnh để layer giữ icon-rotate hằng, ảnh sắc). borderColor null = không viền.
LegStyle
Chú thích chặng (route 1.3, route.md 7.2 "Chặng và chú thích chặng"): huy hiệu tròn phương tiện trên tim đường (iconSizePx, viền, glyph glyphRatio × Ø) + thẻ chip chữ (chip*); vehicles = glyph + màu nền mặc định theo vehicleType. Token route.default.leg — theme riêng chưa khai (chưa biết route 1.3) hay khai thiếu khoá thì lấy số đo sharemap (fallback).
LightProperties
Properties of the style's light root object.
Line
LineLayerProperties
LineManager
LineOptions
Configuration options for Line instances.
LlmClient
Ranh giới duy nhất mà agent nói chuyện với LLM. Provider/vị trí là chi tiết của adapter.
LlmCompleteRequest
LlmCompleteResponse
LocateUserLabels
Chữ của popup / nút — mặc định theo ngôn ngữ (vi / en).
LocateUserOptions
Tuỳ chọn locateUser dạng object (sharemap-engine.md 12d).
LocationEnginePlatforms
Location engine properties that apply across all platforms.
LocationFix
Một lần định vị.
LocationSource
Selects which source feeds location updates into the map's user-location component (the "puck").
ManualLocationSource
An app-provided location source.
ManualLocationUpdate
An app-provided location update, pushed into the map's user-location component via MapLibreMapController.updateManualLocation.
MapAction
Một lệnh trong actions[] của JSON Command Batch.
MapAgentAdapter
MapAgentChatController
MapAgentChatMessage
Một bong bóng chat.
MapAgentClientInfo
Khối client (§3.7) — lời khai để agent chẩn đoán và hiểu "mai 8h sáng"; không bao giờ dùng để phân quyền. KHÔNG có locale: ngôn ngữ trả lời theo câu người dùng gõ — ngôn ngữ máy không phải của người đang gõ (protocol bỏ trường này 2026-10-11).
MapAgentDraft
Chữ của model đang về cho lượt hiện tại (§9.1.3 "Trả lời hai pha").
MapAgentErrorEvent
remote:error — lần gửi hỏng: khung error, stream đứt, lỗi HTTP, gói vượt trần…
MapAgentProgress
Một khung progress: câu ngắn do code của agent viết theo ngôn ngữ câu người dùng gõ — không phải LLM viết, không mang tham số tool. Chỉ để hiện cho người dùng; không bao giờ vào [2].
MapAgentProgressEvent
remote:progress — một khung progress (§9.1.3): agent đang gọi LLM, chạy tool, soạn lệnh.
MapAgentPrompt
Một câu người dùng gõ — đang xếp hàng (MapAgentChatController.pending) hoặc đang chạy (MapAgentChatController.current). id là requestId của lượt sẽ/đang chạy cho câu đó (MapAgentTurn.requestId).
MapAgentReceiveEvent
remote:receive — agent trả [2] (200) hoặc đóng lượt (204).
MapAgentReply
Kết quả một lần gửi.
MapAgentRound
Một vòng vừa chạy xong — để UI vẽ tiến trình.
MapAgentSendEvent
remote:send — client gửi [1] hoặc [3].
MapAgentSendReceipt
Biên nhận của MapAgentChatController.send.
MapAgentSessionStorage
Nơi giữ sessionId qua lần mở app (vd SharedPreferences, localStorage). Chỉ giữ id phiên — không bao giờ key wire (§9.1.7).
MapAgentStreamAssembler
Ghép các khung {type, payload} của một batch thành [2].
MapAgentTransport
Mọi thứ runtime cần từ tầng vận chuyển — để test thay bằng bản giả.
MapAgentTurn
Kết quả một lượt.
MapAiOptions
Cấu hình AI gắn thẳng vào ShareMapLibre(ai: ...). Chỉ llm là bắt buộc.
MapCallRecord
Một lời gọi API map mà engine đã thực hiện, ghi lại tại chính call-site.
MapContext
mapContext 2.0.0 (§3.3, sharemap-context.md §4) — sáu nhóm theo target cộng digest và meta. Không còn marker, ai, aiManaged, popup, terrain: "AI đã vẽ gì" là mọi mục origin: "ai" của inventory.
MapContextDelta
Delta context (§3.5, sharemap-context.md §5.5–§6) — nhớ hash đã gửi gần nhất trong phiên, không phải hash đã tính: gói dựng rồi không gửi được (lỗi mạng) không được làm client tưởng agent đã có bản đó.
MapDigest
L2 — digest (§4.6). Luôn có mặt, không vào contextHash.
MapInteraction
meta.lastInteraction — sự kiện tương tác gần nhất (§4.7).
MapLibreJsSource
Where the web implementation loads MapLibre GL JS from.
MapLibreMap
Shows a MapLibre map. Also refer to the documentation of maplibre_gl and MapLibreMapController.
MapLibreMapController
Controller for a single MapLibreMap instance running on the host platform.
MapLibreMapOptions
Configuration options for the MapLibreMap user interface.
MapLibrePlatform
MapLibreStyles
MapLibre styles used mostly for demonstration.
MapRequestEvent
Một resource mà MapLibre sắp gửi qua native HTTP stack.
MarkerAdapter
MarkerHandle
Handle trả về sau khi cắm — engine giữ để dời/xoá về sau.
MarkerReference
Mention một marker: lngLat bắt buộc; kind (≤ 40), address (≤ 300), day (1–29), date (YYYY-MM-DD) tuỳ chọn.
MarkerSpec
Mô tả một marker cần cắm. Toạ độ theo quy ước GeoJSON [lng, lat].
MemoryStore
Lưu/khôi phục transcript. Đồng bộ — khớp hành vi thật của storage đơn giản. Mọi method phải im lặng chịu lỗi, không bao giờ ném.
MinMaxZoomPreference
Preferred bounds for map camera zoom level. Used with MapLibreMapOptions to wrap min and max zoom. This allows distinguishing between specifying unbounded zooming (null minZoom and maxZoom) from not specifying anything (null MinMaxZoomPreference).
MirrorOp
Một thay đổi app có thể gương sang dữ liệu của chính nó (hook mirror của adapter — mục 13.2). entry = bản ghi sống trong sổ (với set); prev = doc gần nhất máy này đã ghi / nhận cho id đó.
MyLocationStyle
Colors of the user-location puck shown when myLocationEnabled is true.
NullComponentRasterizer
Rasterizer giả cho test / môi trường không vẽ được: PNG 1×1 trong suốt.
OfflineRegion
Description of a downloaded region including its identifier.
OfflineRegionDefinition
Description of region to be downloaded. Identifier will be generated when the download is initiated.
OfflineRegionStatus
Status of an offline region's download.
ParsedManagedId
PinTextImage
Ghim sprite (pin · pin-blue · pin-orange · pin-red) có chữ text (≤ 2 ký tự) vẽ vào hình tròn ở đầu ghim, màu textColor (pinTextColor của component hoặc marker.pin.textColor của theme).
PlannedDropPointDto
PlannedDropPointsBar
PlannedDropPointViewModel
PlannedRouteCommandDto
PlatformLocationSource
The default location source: the platform's native location engine drives the user-location component.
PlaybackConfig
Cấu hình playback (sharemap:playback).
PluginClientInfoSource
Đọc bằng package_info_plus + device_info_plus.
Poi
POI đang hiển thị trên bản đồ ShareMap.
PolygonCommandIds
PolygonData
Lightweight data class for polygons. Replaces google_maps_flutter Polygon with a plain data holder.
PolygonDto
PolylineData
Lightweight data class for polylines / routes. Replaces google_maps_flutter Polyline with a plain data holder.
PopupActionButton
Nút hành động .btn.btn-{variant}: cao button.heightPx, padding ngang 8, viền 1px, icon iconSizePx cách chữ 5, chữ một dòng không cắt; hover / active đổi nền + viền, nhấn thu scale(0.985).
PopupButtonLook
Một biến thể nút (.btn-primary / .btn-secondary).
PopupCardPainter
Vẽ thẻ + mũi tên neo thành một Path (components doc 8.3, Flutter): bóng drop-shadow phủ cả hai, nền chung card.background, viền chỉ quanh thẻ (mũi tên dính liền ngoài cạnh, như .anchor-icon của thiết kế).
PopupCloseButton
Nút đóng .close: dấu ✕ trong hộp close.sizePx², nền trong suốt, hover đổi màu. Màn hình cảm ứng: vùng chạm 44 × 44 vô hình, bố cục không đổi.
PopupContentView
PopupContent (8.2) dựng bằng widget chữ thuần theo cấu trúc thiết kế (8.3) — dữ liệu chứa <script> chỉ hiện ra là chữ.
PopupDeleteButton
Nút xóa .delete (8.3): thùng rác delete.iconSizePx nét 2 giữa hộp delete.sizePx, nền trong suốt; hover đỏ (hoverColor — phá huỷ). Đứng ngay trái ✕, cùng cách căn dòng chữ đầu; vùng chạm 44 × 44 như ✕.
PopupDeleteConfirm
Hàng xác nhận xóa .delete-confirm (8.3): câu hỏi 12 / 600 (line-height 16) màu title.color, gợi ý 11 / 400 (line-height 14) màu subtitle.color cách 2, rồi (gap 8) hai nút chia đôi — Hủy button.secondary (nhận focus — an toàn với bàn phím), Xóa button.danger kèm thùng rác. role="alertdialog": vùng trợ năng riêng, tên = câu hỏi.
PopupInputField
Một ô PopupContent.inputs[] (8.2): text / number là ô gõ, select là danh sách chọn, toggle là công tắc. Commit khi rời ô, bấm Enter, chọn một option hoặc gạt công tắc — không theo từng phím. Giá trị ngoài miền (số ngoài min / max) không commit: ô báo lỗi và giữ chữ đang gõ.
PopupLook
Toàn bộ token thẻ đã đọc (components doc 8.3). Fallback là giá trị theme sharemap — theme gốc buộc khai đủ nên fallback chỉ đỡ look rỗng.
PopupOverlaySpec
Overlay của popup (10.7) — thẻ Flutter vẽ trên bản đồ.
PopupReference
Mention một popup đứng riêng (không anchorTo) — như marker, không ngày.
PopupShadow
Bóng card.shadow (CSS box-shadow) → drop-shadow Flutter: lệch, độ nhoè (σ = blur / 2 như CSS), màu. Bỏ spread / inset như drop-shadow().
PopupShareButton
Nút chia sẻ .share (8.3): icon share.iconSizePx nét 2 giữa hộp share.sizePx, hover như ✕ (không phá huỷ). Giữa nút xóa và ✕; bấm phát action actionId: "share" — tạo link là việc của app.
PopupTextLook
Chữ của một phần thẻ: cỡ / đậm / màu.
PopupTileLook
Một ô của hàng lịch (visitDay · visitPeriod · visitPeriod.moon): nền + màu icon.
PopupUiText
Bộ chữ của một ngôn ngữ giao diện.
RasterDemSourceProperties
RasterImage
Ảnh đã vẽ — PNG cho controller.addImage(id, bytes).
RasterLayerProperties
RasterSourceProperties
ReferenceStop
Một điểm dừng trong reference route / trip-plan ($defs/ReferenceStop): id marker điểm dừng, n số thứ tự (≥ 1), lngLat vị trí hiện tại engine đang vẽ.
RemoteApplyResult
Kết quả một lần áp từ xa: ok hay danh sách lỗi (code, message).
RemoteChange
Thay đổi từ kho chung. local = do chính máy (tab) này ghi — bộ máy bỏ qua để không vang.
RequestParameters
RetrievedDoc
Tài liệu do retriever trả về (RAG-lite).
RouteCommandIds
RouteLook
RouteReference
Mention một route: stops bắt buộc (≤ 30, theo thứ tự); plan = id trip-plan chứa route. Không gửi hình học tuyến.
SchemaError
Một chỗ vi phạm: path là JSON Pointer (RFC 6901) tới giá trị sai.
SchemaViolation
ServerProxyAdapter
ShareMapAndroidNotificationOptions
Optional Android foreground notification text.
ShareMapAndroidTrackingOptions
Android location-request options.
SharemapClientInfo
Bộ thông tin nhận dạng của một client, đã làm sạch và sẵn sàng lên dây.
ShareMapDataset
Dataset app đăng ký bằng code — gói chỉ tham chiếu tên qua source.addOrUpdate.dataset; dữ liệu đã ở trong client, không qua AI (§3.1).
ShareMapEngine
ShareMapEngineOptions
ShareMapIcon
Tên icon dùng được cho marker.icon.name (component, phase 2).
ShareMapInteractionEvent
Sự kiện tương tác engine phát ra ngoài — layer có interaction.events (§4.1) hoặc marker hàng loạt có events. Host app nhận qua ShareMapEngineOptions.onInteraction.
ShareMapIOSTrackingOptions
iOS CLLocationManager options used by an active tracking session.
ShareMapLayerIds
Pre-defined layer IDs built into the ShareMap style JSON. Use these constants to dynamically show, hide, or restyle layers on the map using controller.setLayerVisibility(layerId, 'visible' | 'none') or raw paint/layout operations.
ShareMapLibre
Public ShareMap entry point and premium map widget.
ShareMapLibreController
Imperative controls for refreshing POI tiles after a mutation.
ShareMapLocation
A platform-independent location emitted by ShareMap background tracking.
ShareMapLocationError
A sanitized, platform-independent location error.
ShareMapLocationStatus
A complete snapshot of native background location state.
ShareMapPoi
Standard Data Model representing a POI extracted from a map layer or server.
ShareMapPoiService
Standalone Service to interact with the ShareMap POI REST APIs.
ShareMapPoiType
Represents a POI type and its associated server-side icon/style properties.
ShareMapPoiTypes
Catalog & Server-Driven extraction of POI types from MapLibre style JSON.
ShareMapSpriteIcon
A widget that renders an icon directly from the server MapLibre Sprite Sheet.
ShareMapSpriteItem
Metadata for a single sprite icon in the sprite atlas.
ShareMapSpriteService
Service that fetches, parses, and caches the server Sprite Sheet (PNG + JSON) and provides decoded images for Flutter widgets.
ShareMapTemplate
Template app đăng ký (registerTemplate, components doc mục 9): công bố ở capabilities.templates (data bỏ trường format: "image-url"), Pha A kiểm tên, loại và data theo data (dataSchema), engine component dựng bằng popupBuilder (kind: popup) hoặc renderImage (kind: marker).
ShareMapTemplateContext
Kênh của template popup về engine (components doc mục 9 render(data, ctx)).
ShareMapTemplateInput
Một ô nhập template popup ghi được qua ctx.setInput (components doc mục 9) — cùng miền với PopupContent.inputs[] nhưng không label / value / placeholder (form do template tự vẽ). Vào nguyên dạng capabilities.templates[].inputs.
ShareMapTrackingOptions
Options applied when a new native tracking session starts.
SkyProperties
Properties of the style's sky root object.
SMAnimation
SMAnimationBinding
Một route + các marker chạy trên nó (bindings[], 15.1).
SMAnimationMarker
Một marker trong binding (bindings[].markers[], 15.1).
SMComponentBase
Lõi chung: id, origin, engine, hàng đợi, bộ nghe sự kiện, gửi command.
SMIcon
Dạng icon của marker (6.2) — trả đúng JSON của items[].icon.
SMLabel
Dạng label dạng object của marker (marker 1.4, marker.md 6.2 "Thẻ nhãn") — trả đúng JSON của items[].label. Chuỗi vẫn là nhãn chữ thuần.
SMMarker
SMPopup
SMRoute
SMTripPlan
SourceContextItem
L1 — một mục source.items (§4.3).
SourceMarkers
source.items[].markers — marker hàng loạt cắm từ source bằng marker.addFromSource (thay nhóm marker.bySource của 0.1.0).
SourceProperties
SpriteImage
Bản sao một icon của sprite nền (icon.name, kind: "other") — chỉ khi phải vẽ khung lên nó (10.5 border). sizePx null = cỡ gốc.
SseEvent
Một sự kiện SSE đã ghép xong. event null khi không có dòng event:.
Success
Symbol
SymbolLayerProperties
SymbolManager
SymbolMarkerAdapter
Bản mặc định — dùng Symbol annotation của maplibre_gl.
SymbolOptions
Configuration options for Symbol instances.
SyncBatch
batch của doc: lượt ghi (responseTo ai · user), seq transport cấp trong transaction, vị trí trong gói (itemIndex) — snapshot đầu dựng lại theo (seq, itemIndex) (mục 6).
SyncDeleteOp
Xoá doc id.
SyncDoc
Một doc mapComponents/{componentId} (mục 4). config là phần tử add đã gộp lớp phủ (export) — kế hoạch lưu rút gọn routes → routeIds theo day (mỗi route lồng một doc riêng, meta.planOf); popup không mang open (mở / đóng là của từng người xem).
SyncDocMeta
meta của doc: quan hệ sở hữu + tag (mục 4).
SyncOp
Một thao tác ghi kho của bộ máy.
SyncSetOp
Ghi (thay) doc id bằng doc (dạng nháp).
SyncUser
Người dùng của transport — thiếu = chỉ đọc (không bao giờ write).
TemplateImage
TemplatePopupRequest
Yêu cầu mở popup mẫu (TemplatePopup) của layer / marker hàng loạt.
TerrainProperties
Properties of the style's terrain root object.
TileAuth
Kết quả quyết định xác thực cho một request tile.
TilesTokenSource
Giữ một tiles token cho cả phiên và làm mới khi cần.
TimeIndex
Cấu trúc tra cứu dựng sẵn một lần mỗi lần cập nhật dữ liệu, để mỗi frame chỉ tốn một binary search O(log n) thay vì quét lại cả path.
Tool
Một tool client-side mà LLM có thể chọn.
ToolCall
ToolContext
ToolError
ToolMessage
ToolResult
ToolSpec
Định nghĩa tool gửi cho LLM để nó chọn.
TouristPointIconView
Icon (viewBox 24 × 24, vẽ cỡ size) đúng SVG symbol của thiết kế (tp-calendar · tp-sun · tp-moon · tp-note · tp-pin trong index.html), tô color (currentColor = token iconColor). Ẩn với trình đọc màn hình (aria-hidden).
TouristPointLook
Token thẻ popupType: "tourist-point" (components doc 8.3, "Giao diện tourist-point") — nhóm touristPoint của popup.default ← preset. frame là PopupLook của khung thẻ (card · title · close · anchorIcon của touristPoint, hàng nút button chung với location) — painter một Path, nút đóng và hàng nút đọc nó như thẻ location.
TouristPointView
Thẻ popupType: "tourist-point" (components doc 8.3, "Giao diện tourist-point") — đúng Popup 3 của thiết kế: .tourist-popup__header (nhãn category + tiêu đề xuống dòng | nút ✕) › hàng lịch .tourist-popup__schedule (ô ngày · ô buổi) › hàng ghi chú .tourist-popup__note › .tourist-popup__divider › hàng địa chỉ .tourist-popup__location (ghim + "Trên bản đồ" + subtitle) › hàng nút chung .buttons-N. Chữ ngày / buổi / "Trên bản đồ" / nhãn mặc định do engine sinh theo uiText — bên gửi chỉ ghi dữ liệu extra.visit.
TrackingGroupState
TrackingMarkerCommandDto
TrackingPanel
Shared collapsible Material surface. Slots keep business UI in the host app.
TrackingVehicleCommandDto
TrajectoryCursor
Cursor Feature — Point với sharemap:type == 'trajectory-cursor'.
TrajectoryPath
Path Feature — LineString với sharemap:type == 'trajectory'.
TrajectoryPlaybackOptions
TrajectorySample
TrajectoryState
TrajectoryTickInfo
Thông tin mỗi frame + mỗi lần seek — app dùng để cập nhật slider/tooltip.
TrajectoryValidation
TripPlanDayReference
Một ngày của reference trip-plan: route routeId của ngày day.
TripPlanReference
Mention một trip-plan: days bắt buộc (theo day; điểm dừng mỗi ngày ≤ 30, tổng ≤ 100). startDate (ngày của Day 1) chỉ khi app biết.
UiComponentRasterizer
UrlImage
UserHeading
Type represents a geomagnetic value, measured in microteslas, relative to a device axis in three dimensional space.
UserLocation
User's observed location
UserLocationContext
mapContext.userLocation: toạ độ chỉ đi cùng UserLocationStatus.ok.
UserLocationPlatform
Phần nền tảng module dùng — tiêm được để test; mặc định GeolocatorUserLocationPlatform.
UserLocationPromptCard
UserLocationTracker
Quyền + vị trí của một bản đồ. Đổi context hoặc prompt thì báo listener.
UserMessage
ValidationContext
Trạng thái engine mà validator cần — mọi thứ "client này làm được gì".
ValidationError
Lỗi Pha A của một action.
VectorSourceProperties
VehicleAnimation
VehicleDetailPopup
VehicleHistoryPanel
Controlled range, playback and network state; no API requests inside widgets.
VehicleTrackingController
Owns fleet, planned routes, one history playback and tracking markers.
VideoSourceProperties
A video drawn over four corners of the map.
ViewPadding
camera.padding — phần khung bị panel của app che (setViewPadding).
WireErrorCodes
Mã lỗi tầng wire. Hai mã WIRE_* không bao giờ nằm trong [3] (§9.1.7).

Enums

ActionStatus
Trạng thái thực thi của một action.
AgentErrorScope
Khâu phát sinh lỗi của agent.
AmjsonWireMode
Kênh mã hoá muốn dùng (§9.1.7).
AndroidComposition
Who puts the Android map on screen with your widgets.
AndroidMapSurface
The native view MapLibre draws the Android map into.
AnnotationType
AttributionButtonPosition
Attribution Button Position
BatchOrigin
Batch đến từ đâu (§5.1.1) — quyết định namespace batch được đụng.
CameraAnimationInterpolation
Easing curve for MapLibreMapController.easeCamera animations.
CameraMoveReason
What started a movement of the camera.
CommandSource
Nguồn phát một JsonCommandBatch.
CompassViewPosition
Compass View Position
ComponentSyncStatus
connecting → live (snapshot đầu đã lên bản đồ) → error (nghe hỏng: rules chưa dán, bị mời ra — sync tự dừng và gỡ component đã đồng bộ).
DebugGroup
Nhóm dùng để lọc timeline và tô màu.
DebugStatus
warn = không hỏng, nhưng đáng xem (vd agent huỷ lượt cũ vì có lượt mới — SUPERSEDED). Timeline tô vàng; "Chỉ lỗi" và badge chỉ tính error.
DebugViewMode
Hai cách xem của Debug Panel — LLM chạy ở đâu thì luồng khác hẳn nhau.
DragEventType
FlowStage
Chặng trong sơ đồ luồng module. Mỗi DebugViewMode vẽ một dãy riêng (DebugViewMode.stages); user/engine/map có ở cả hai.
HistoryPanelStatus
HoverEventType
InventoryMode
meta.inventory (§3.5): full ⇒ bốn nhóm L1 có mặt; omitted ⇒ cả bốn vắng, contextHash thay cho chúng.
LocationPermissionState
Quyền vị trí theo nghĩa của engine.
LocationPriority
An enum representing the priority for location accuracy and power usage. (Android only)
LocationStreamError
Lỗi của stream vị trí.
LogoViewPosition
Logo View Position
MapAgentPacketKind
Loại gói client gửi lên Map Agent.
MapAgentProgressStage
Agent đang làm gì trong lúc chờ.
MyLocationRenderMode
Specifies if and how the user's heading/bearing is rendered in the user location indicator.
MyLocationTrackingMode
The camera mode, which determines how the map camera will track the rendered location.
OnErrorStrategy
Chiến lược khi một action lỗi giữa batch.
PanInertia
How long the map keeps gliding after a pan.
ResourceType
ResultStatus
Kết cục cả batch trong 3 (§7.1). rejected ⇒ không action nào chạy, bản đồ y nguyên.
ScaleControlPosition
Scale Control Position
ScaleControlUnit
Scale Control Unit
ShareMapAccuracyAuthorization
Accuracy authorization selected by the user or platform.
ShareMapIOSActivityType
Activity hints supported by Apple's CLLocationManager.
ShareMapIOSDesiredAccuracy
Desired accuracy values supported by Apple's CLLocationManager.
ShareMapLocationErrorCode
Stable error categories produced by background location tracking.
ShareMapLocationServicesState
Device Location Services availability.
ShareMapMode
Environment mode for ShareMap, controlling logging and URL endpoints.
ShareMapPermissionState
Authorization currently granted to background location.
SharemapPlatform
Nền tảng client. Giá trị chuỗi là thứ đi lên dây, phải khớp typeApplication trong bảng sharemap-api-key.
ShareMapStyle
Available map styles for ShareMap.
ShareMapTrackingState
Lifecycle state of the native tracking session.
TouristPointIcon
Icon engine sở hữu của thẻ tourist-point (8.3 "Biểu tượng") — không icon nào lấy từ dữ liệu.
TrackingGroup
TrackingStatus
TrajectoryPlaybackStatus
UsageReport
Mức báo cáo token/chi phí client nhận trong [2] (§4.12).
UserLocationPrompt
Popup cần hiện: chưa hỏi · bị từ chối · dịch vụ vị trí tắt (mobile) · không định vị được.
UserLocationStatus
userLocation.status — schema $defs/UserLocation.

Extensions

MapLibreColorConversion on Color
ShareMapPoiExtension on MapLibreMapController
Extension on MapLibreMapController to easily extract rendered POIs from the map viewport.
ShareMapStyleExtension on ShareMapStyle
Extension on ShareMapStyle to retrieve the configuration values.

Constants

defaultLayersTokenUrl → const String
Endpoint phát token layers.
defaultTilesTokenUrl → const String
Endpoint phát token của môi trường production.
kAiPrefix → const String
Prefix cho mọi source/layer/image do AI tạo (§5.1.1).
kAllowedLayerTypes → const Set<String>
6 loại layer layer.add được tạo (§5.2).
kAllTools → const List<Tool>
Bộ tool mặc định: 9 Map/Context + 8 Geomesh + 9 Math = 26.
kAllVehicleTypes → const List<String>
Mọi legs[].vehicleType (hình dạng — hợp loại kiểm sau khi gộp).
kAmjsonWireMediaType → const String
Media type của body mã hoá. Request kèm tham số kid.
kAnimationEasings → const Map<String, List<double>>
bindings[].markers[].easing (15.1) — đường cong CSS cubic-bezier.
kAnimationFills → const List<String>
fill của animation (15.1): hold (mặc định) · reset.
kAnimationFollowModes → const List<String>
follow.mode của animation (15.4).
kAppPrefix → const String
Prefix cho mọi source/layer/image do host app tạo (§5.1.1).
kBatchFields → const Set<String>
Field cấp batch của 2 (amjson-command.schema.json 2.0.0).
kCommandReadLimitBytes → const int
[2] Command — quá mức này client không đọc nữa (chống bom): lượt hỏng, không có [3].
kComponentCommands → const Set<String>
Bốn lệnh của target component — chỉ chạy khi engine có ComponentHandler.
kComponentIdKinds → const List<String>
kind của id component (phase 2) và imageId.
kComponentTypes → const List<String>
marker · route · popup · trip-plan (chương 14 — gói route, không vẽ) · animation (chương 15 — marker chạy theo route, không vẽ riêng).
kComponentVersions → const Map<String, String>
componentVersions — version riêng của từng AMJSON Component engine này hiện thực (components doc 5.6): "MAJOR.MINOR", độc lập với kProtocolVersion. Đi ngay sau version trong 1 (khi có capabilities.components / mapContext.component), 2 (khi có action target: "component" — chỉ các loại command dùng) và 3 (khi có mapContext.component). Chỉ khai báo: không bên nào rẽ nhánh hay từ chối gói dựa trên nó.
kDebugBufferCapacity → const int
Số event giữ lại trong ring buffer để panel mở giữa chừng vẫn thấy quá khứ.
kDefaultBatchOrigin → const BatchOrigin
Thiếu origin = app (§5.1.1 luật 3). Vì vậy mọi đường nhận lệnh của AI phải ghi đè origin: ai — xem ShareMapEngine.executeAiBatch.
kDefaultPropertyWhitelist → const Set<String>
Whitelist thuộc tính mặc định (§3.4 bước 3) — tên, phân loại, trạng thái và quy ước tóm tắt tuyến đường (MC-3). Thuộc tính khác (số điện thoại, ghi chú nội bộ, id hệ thống) không đi tới provider LLM. App mở rộng qua ShareMapEngineOptions.propertyWhitelist.
kDefaultSystemPrompt → const String
System prompt mặc định — copy nguyên văn từ bản web để hai nền tảng cho cùng hành vi model. Điều 5 là hàng rào chống prompt-injection từ dữ liệu tool.
kDefaultTools → const List<Tool>
Registry mặc định: 1 Context tool + 8 Map tool.
kDefaultUiLocale → const String
Ngôn ngữ giao diện mặc định.
kDirectVehicleTypes → const List<String>
Phương tiện của chặng direct-route (route 1.5) — chỉ hợp lệ trong direct-route; ngoài glyph + màu còn mang nét direct mặc định.
kEarthRadiusKm → const double
Bán kính Trái Đất trung bình (WGS84 mean radius), tính bằng km.
kEarthRadiusM → const double
Bán kính trung bình Trái Đất (m) — như turf length.
kEventStreamMediaType → const String
Media type của kênh SSE.
kFollowPitchEpsilon → const double
Pitch (độ) camera follow đặt kèm khi bản đồ phẳng tuyệt đối (web). Bản đồ chỉ dịch mà pitch == 0 thì MapLibre GL JS lấy mẫu ảnh icon NEAREST (chữ SDF, nét đường vẫn nội suy): camera trôi lẻ pixel làm icon POI đứng rồi nhảy cả pixel, lệch khỏi nhãn ("giật"). pitch != 0 → icon LINEAR, trôi mượt cùng bản đồ; 0.001° mắt không thấy. Hết theo dõi thì engine trả về 0.
kGeomeshDefaultBaseUrl → const String
kGeomeshTools → const List<Tool>
Geomesh service tools — thêm vào registry khi có client Geomesh.
kGlyphFallbackColor → const Color
Màu nền khi color không đọc được.
kIconKinds → const List<String>
icon.kind của dạng { name }: pin (mặc định) · other.
kInternalPrefix → const String
Tiền tố tài nguyên nội bộ của engine (source/layer cố định mà engine component vẽ lên — components doc 3.1, 10.2). Không lệnh source.* / layer.* nào đụng được, và không xuất hiện ở mapContext.
kMapAgentProtocolVersion → const String
Bản protocol mà Agent Runtime này nói.
kMathTools → const List<Tool>
Math / GIS tools: Phase A (thuần) + Phase B (buffer/area/within, cũng thuần).
kMaxAnimatedLayers → const int
kMaxCommandBytes → const int
[2] Command — trần của agent. Vượt thì client trả [3] rejected, mọi action PAYLOAD_TOO_LARGE.
kMaxComponentItems → const int
kMaxFeaturesPerSource → const int
Trần mặc định của spec (§9.6, capabilities.limits).
kMaxFeatureStateIds → const int
kMaxImageDataUrlBytes → const int
kMaxImageSidePx → const int
kMaxImagesPerOrigin → const int
kMaxInputBytes → const int
[1] Input — client dựng gói trong trần.
kMaxMarkersPerSource → const int
kMaxPatchOperations → const int
kMaxPromptLength → const int
Trần payload.prompt (§3.1).
kMaxResultBytes → const int
[3] Result — cả gói.
kMaxResultDataBytes → const int
[3] Result — tổng results[].data (dữ liệu L3).
kMentionLabelMax → const int
Trần label của reference (= $defs/*Reference.label.maxLength của amjson-input; lib và Fleet cùng cắt ở đây).
kPinNames → const List<String>
Bốn ghim có đầu nhọn trong sprite của style nền — tên duy nhất hợp lệ cho icon: { name, kind: "pin" } (mục 6.2). Engine không có ghim dựng sẵn riêng: mọi hình lấy từ sprite nạp cùng bản đồ.
kPlanTag → const String
Tag của lịch trình địa danh (spec §5.7).
kPopupActionIconPaths → const Map<String, String>
Path SVG (viewBox 24×24, fill) — directions / add-place / share lấy nguyên từ thiết kế sharemap-popup.
kPopupFontFamily → const String
Font của thẻ (hằng số của thiết kế — theme không chọn font). App phải khai font Inter trong pubspec để khớp số đo; thiếu thì Flutter lùi về font hệ thống.
kPopupTypes → const List<String>
popupType — bố cục engine dựng từ content (8.2), tập đóng. Bỏ trống = location (thẻ của popup 1.0).
kProtocolVersion → const String
Phiên bản protocol mà engine này nói.
kRagTools → const List<Tool>
RAG tools — thêm vào registry khi app có retriever.
kReferencesMax → const int
Tối đa số mục trong payload.references (§3.1).
kReferencesMaxBytes → const int
Trần cả mảng references — byte UTF-8 của JSON thu gọn (§3.1, §10).
kRoutePathModes → const List<String>
pathMode của direct-route (route 1.5); bỏ trống = geodesic.
kRouteVehicleTypes → const List<String>
Phương tiện đường bộ của một chặng (route 1.3, route.md 7.2 "Chặng và chú thích chặng") — chọn glyph + màu nền mặc định từ route.default.leg.vehicles. Chỉ hợp lệ ngoài direct-route.
kSharedTag → const String
Tag đánh dấu component app-* thuộc dữ liệu chung của bản đồ (place nhập tay — mục 13.4).
kSharemapBearingsKey → const String
kSharemapEntityIdKey → const String
kSharemapEntityLabelKey → const String
kSharemapPlaybackKey → const String
kSharemapSourceId → const String
Id của source POI dựng sẵn trong style ShareMap.
kSharemapSpeedsKey → const String
kSharemapStatusesKey → const String
kSharemapThemeJson → const String
Theme sharemap — luôn có sẵn trong engine, là theme nền cho extends.
kSharemapTimestampsKey → const String
kSharemapTypeKey → const String
kSourceIdKinds → const List<String>
kind của sourceId (§5.1.1).
kSupportedUiLocales → const List<String>
Ngôn ngữ giao diện hỗ trợ — tối thiểu vi và en (8.2).
kThemedComponentTypes → const List<String>
Loại có hình riêng — có mục default / presets trong theme (theme doc 4). trip-plan / animation không vẽ gì nên không có mục theme (14.2, 15.1).
kTrajectoryCursorType → const String
kTrajectoryType → const String
kVisitPeriods → const List<String>
extra.visit.period — trùng tập period của mentions (8.2).
kWhitelistedCommands → const Set<String>
25 cặp target.command của whitelist §5.2 (2.0.0).
kWireVersion1 → const int
Byte phiên bản của định dạng v1: deflate-raw, không từ điển, AES-256-GCM.
maxUserAgentLength → const int
Trần độ dài User-Agent.
sharemapClientHeaderName → const String
Tên header cấu trúc. Phải khớp phía server, và phải có trong access-control-allow-headers của cả TOKEN_CORS lẫn rule ALB.
sharemapClientHeaderVersion → const String
Phiên bản của định dạng X-Sharemap-Client.
sharemapSdkVersion → const String
Phiên bản SDK, đi vào cả UA lẫn X-Sharemap-Client.
tilesTokenErrorCooldown → const Duration
Khoảng chờ tối thiểu giữa hai lần làm mới do lỗi 403.
tilesTokenParam → const String
Tham số query mang tiles token. Phải khớp TOKEN_PARAMS trong sharemap-osrm/protomaps/tiles-auth/function/tiles-auth.js và TOKEN_PARAM bên sharemap-maplib-reactjs — lệch tên là token không được đọc và không được đếm.
tokenUrlByService → const Map<String, String>
Endpoint phát token theo service. Mỗi service một route riêng.

Properties

amjsonCommandSchema → JsonSchemaValidator
amjson-command.schema.json đã parse — dùng chung cho mọi lần kiểm.
final
cachedSharemapClientInfo → SharemapClientInfo?
Thông tin đã đọc xong, hoặc null nếu chưa gọi loadSharemapClientInfo.
no setter
debugBus → DebugBus
Singleton — Engine/Agent/GeomeshClient/UI đều dùng cái này.
final
kGlyphNames → List<String>
Tên glyph cho capabilities.glyphs[].
final
kLayerRoleRe → RegExp
vai trong id layer {sourceId}-{vai}.
final
kManagedIdRe → RegExp
Biểu thức kiểm của spec (§5.1.1).
final
sharemapGlyphs → Map<String, GlyphDef>
Bộ glyph theo tên — thứ tự của bộ (location đầu).
final

Functions

animationEase(String easing, double t) → double
Tiến độ đường cong easing tại tỉ lệ thời gian t ∈ 0, 1 (lạ → linear).
animationSyncItem(Map<String, dynamic> local, Map<String, dynamic> remote) → Map<String, dynamic>
Phần tử update đưa animation trong sổ (local — cấu hình đang có) về đúng doc từ xa (remote). update bindings gộp theo khoá (chương 15 mục 3) nên gửi nguyên bindings của doc không bỏ được marker / binding máy kia đã bỏ: bản vá kèm { routeId, remove: true } / { markerId, remove: true } cho phần chỉ còn ở local, null cho trường doc không còn (về mặc định). Dùng update (không add lại) để marker đang chạy trên máy này không bị chạy lại từ at khi chỉ đổi playing / speed…
applyL3Budget(List<Map<String, dynamic>> results, {int budget = kMaxResultDataBytes}) → List<Map<String, dynamic>>
Áp ngân sách L3 (§3.4 bước 6) lên bản sao của results trong một 3.
attachDebugConsole([AttachDebugConsoleOptions options = const AttachDebugConsoleOptions()]) → void Function()
Gắn logger vào debugBus. Trả về hàm gỡ.
attachLayersToken(String url, TilesTokenSource? source) → String
Đính token layers vào URL tile của layers.sharemap.live.
attachTilesToken(String url, TilesTokenSource? source) → String
Đính tiles token vào url nếu có sẵn token dùng được.
bboxOf(List<List<double>> coords) → List<List<double>>?
Bounding box của một tập toạ độ, bỏ qua mọi cặp không hữu hạn.
boundsOf(List<List<double>> points) → List<List<double>>
buildCommandBatch(List<MapAction> actions, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
buildComponentReferences(ComponentMemory memory, Iterable<String> ids, {ComponentMentionStrings strings = ComponentMentionStrings.vi, DescribeComponent? describe}) → List<ComponentReference>
references[] gửi kèm lượt hỏi (§4.2, §4.4) cho các id ids (theo thứ tự token trong câu): id không còn trong sổ / không mention được bị bỏ (câu vẫn gửi); qua normalizeReferences (≤ 5 mục, cắt chuỗi, ≤ 16 KB). Gọi lúc gửi — MapAgentChatController.send(…, references: () => …).
buildFeatureCollection(List<Map<String, dynamic>> features) → Map<String, dynamic>
buildLayerProperties(String type, Map<String, dynamic> props) → LayerProperties
Dựng LayerProperties từ map phẳng kebab-case (gộp paint + layout).
buildMapAgentInput({required String requestId, required String prompt, required MapContext mapContext, required EngineCapabilities capabilities, InventoryMode inventory = InventoryMode.full, String? sessionId, UsageReport usageReport = UsageReport.none, bool mapLinks = false, MapAgentClientInfo? client, List<ComponentReference>? references}) → Map<String, dynamic>
[1] AMJSON Input 2.0.0 (§3.1).
buildMapAgentInputFromEngine(ShareMapEngine engine, {required String requestId, required String prompt, String? sessionId, UsageReport usageReport = UsageReport.none, bool mapLinks = false, MapAgentClientInfo? client, List<ComponentReference>? references}) → Future<Map<String, dynamic>>
Tiện ích: dựng [1] thẳng từ engine — luôn full (không có trạng thái delta). Runtime dùng MapContextDelta để gửi omitted khi được phép.
buildTimeIndex(TrajectoryPath path) → TimeIndex
canonicalJson(Object? value) → String
JSON chuẩn hoá để băm (§3.5): khoá sắp xếp, số làm tròn 6 chữ số, không khoảng trắng — ổn định với cùng nội dung, không phụ thuộc thứ tự duyệt Map.
clearAmbientCache() → Future<void>
Removes all tiles from the shared ambient cache that are not associated with any offline region. Call this after deleteOfflineRegion to fully evict tiles that would otherwise be reused by a future download of the same area.
clearSharemapClientInfoCache() → void
Xoá cache. Dành cho test, và cho trường hợp đổi nguồn đọc lúc chạy.
clearTilesTokenCache() → void
Xoá cache token. Dành cho lúc đăng xuất/đổi tài khoản, và cho test.
collectCoords(Object? geojson, [List<List<double>>? out]) → List<List<double>>
Gom mọi cặp [lng, lat] từ bất kỳ GeoJSON geometry/feature/collection nào.
compactFeatures(List<Object?> features, {int cap = 50, Set<String> whitelist = kDefaultPropertyWhitelist, bool allowAllProperties = false}) → Map<String, dynamic>
Pipeline nén L3 cho một lần query (§3.4): dedupe/gộp mảnh theo id, cap, làm tròn toạ độ, báo rõ đã cắt. Thuộc tính đi qua whitelist (mặc định kDefaultPropertyWhitelist).
compactLayerFeatures(List<Object?> raw, {required String layerId, required Set<String> whitelist, bool allowAllProperties = false, int cap = 50}) → ({List<Map<String, dynamic>> features, int totalBeforeCap, bool truncated})
L3 — feature đầy đủ của một layer (§3.4, sharemap-context.md §5.4): điểm khử trùng theo id; đường/vùng cùng id gộp mảnh thành MultiLineString/MultiPolygon (một tuyến qua bốn tile không bị cắt còn một đoạn); làm tròn 5 chữ số; ≤ cap feature, báo truncated + totalBeforeCap.
componentLabel(ComponentMemory memory, String id, {ComponentMentionStrings strings = ComponentMentionStrings.vi}) → String?
Tên hiển thị của component id trong memory (§3.3); null khi không gọi tên được, không có, hoặc loại không mention được (animation).
componentVersionsShapeProblem(Object? v) → String?
Hình dạng componentVersions (schema $defs/ComponentVersions): object khác rỗng, khoá ∈ marker · route · popup · trip-plan · animation, giá trị ^\d+\.\d+$. Trả thông điệp lỗi, null = hợp lệ. Chỉ kiểm hình dạng — không đối chiếu với kComponentVersions.
createBuildingsCommandBatch(BuildingsDto buildings, {bool fitCamera = true, double pitch = 45, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'buildings')}) → JsonCommandBatch
createCameraCommandBatch(CameraDto camera, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createClearLayerCommandBatch({List<String> layerIds = const [], List<String> sourceIds = const [], List<String> imageIds = const [], CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createClearMapCommandBatch({CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
Clears content belonging to options.origin, following the protocol's rules.
createFeatureQueryCommandBatch(List<double> point, {List<String>? layers, CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createFleetCommandBatch(List<TrackingVehicleCommandDto> vehicles, {bool showLabels = true, double iconPixelRatio = 1, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-vehicle-tracking', onError: OnErrorStrategy.continueOnError)}) → JsonCommandBatch
createGeomeshClient({String? apiKey, String? secretKey, String? baseUrl, Client? httpClient, void onEvent(DebugEvent event)?}) → GeomeshClient?
Dựng client từ credential đã khai ở widget ShareMapLibre. Trả null khi chưa có xApiKey — caller hiểu là "không có Geomesh tool".
createHistoryTrajectoryCommandBatch(HistoryTrajectoryCommandDto trajectory, {bool fitBounds = true, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-history', onError: OnErrorStrategy.continueOnError)}) → JsonCommandBatch
createImageCommandBatch(List<ImageDto> images, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createPlannedRouteCommandBatch(PlannedRouteCommandDto route, {bool fitBounds = true, double padding = 80, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-planned-route', onError: OnErrorStrategy.continueOnError)}) → JsonCommandBatch
createPolygonCommandBatch(PolygonDto polygon, {bool fitCamera = true, double padding = 80, double maxZoom = 16, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'polygons')}) → JsonCommandBatch
createRemoveBuildingsCommandBatch(String id, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'buildings')}) → JsonCommandBatch
createRemoveFleetCommandBatch({Iterable<String> iconUrls = const [], CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-vehicle-tracking')}) → JsonCommandBatch
createRemoveFleetImagesCommandBatch(Iterable<String> urls, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-vehicle-tracking')}) → JsonCommandBatch
createRemoveHistoryTrajectoryCommandBatch(String entityId, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-history')}) → JsonCommandBatch
createRemoveImageCommandBatch(List<String> imageIds, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createRemovePlannedRouteCommandBatch(String routeId, {Iterable<String> iconUrls = const [], CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-planned-route')}) → JsonCommandBatch
createRemovePolygonCommandBatch(String id, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'polygons')}) → JsonCommandBatch
createRemoveTrackingMarkersCommandBatch({CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-tracking-markers')}) → JsonCommandBatch
createRemoveTrajectoryCommandBatch(String entityId, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'trajectory-playback')}) → JsonCommandBatch
createSetFilterCommandBatch(String layerId, List? filter, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createSetLayersVisibilityCommandBatch(List<String> layerIds, bool visible, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createSetPaintCommandBatch(String layerId, String propertyName, Object? value, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createSetVisibilityCommandBatch(String layerId, bool visible, {CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
createTilesTokenSource({required bool enabled, String service = 'tiles', String? apiKey, String? secretKey, String? tokenUrl, Client? httpClient, DateTime now()?, TilesTokenSigner? signer, void onWarn(String message)?}) → TilesTokenSource?
Dựng nguồn token từ cấu hình của widget, hoặc null khi không dùng được.
createTrackingMarkersCommandBatch(List<TrackingMarkerCommandDto> markers, {CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'crm-tracking-markers')}) → JsonCommandBatch
createTrajectoryCommandBatch(HistoryTrajectoryCommandDto trajectory, {bool fitBounds = false, CommandBuilderOptions options = const CommandBuilderOptions(namespace: 'trajectory-playback', onError: OnErrorStrategy.continueOnError)}) → JsonCommandBatch
Generic trajectory playback shares the history convention on Flutter.
createVehicleFocusCommandBatch(List<double> coordinate, {double zoom = 15, bool animate = false, CommandBuilderOptions options = const CommandBuilderOptions()}) → JsonCommandBatch
cubicBezier(double x1, double y1, double x2, double y2) → double Function(double t)
Hàm cubic-bezier(x1, y1, x2, y2) của CSS: P0 = (0, 0), P3 = (1, 1). Giải x(u) = t (Newton, lùi về chia đôi) rồi trả y(u).
decodeExpSeconds(String? token) → int?
Đọc exp (giây epoch) từ phần payload của token, không xác thực chữ ký.
decodeNestedArrays(Object? value) → Object?
Ngược của encodeNestedArrays: map đúng một khoá $a mang mảng → mảng.
decodeTokenService(String? token) → String?
Service ghi trong payload token: trường s; vắng mặt nghĩa là tiles. Trả null nếu không đọc được payload.
deepMergeTheme(Map<String, dynamic> base, Map<String, dynamic> patch) → Map<String, dynamic>
Gộp sâu theo luật của theme (mục 2): object gộp theo khoá, giá trị vô hướng và mảng thay, null xoá khoá. Trả object mới, không đụng tham số.
deleteOfflineRegion(int id) → Future<void>
Deletes the offline region with the given id and the tiles only it uses.
describeEvent(DebugEvent e) → DebugEventSummary
destinationPoint(List<double> origin, double distanceKm, double bearingDeg) → List<double>
Điểm đích khi đi distanceKm từ origin theo phương vị bearingDeg. Nghịch đảo của getBearing/getDistance — dùng để dựng vùng đệm tròn.
detachDebugConsole() → void
Gỡ logger đang gắn (nếu có). An toàn khi gọi nhiều lần.
detectTrajectories(Object? geojson) → List<DetectedTrajectory>
Quét một GeoJSON tìm trajectory path + cursor, gom theo sharemap:entityId. Trả danh sách rỗng khi không có trajectory nào.
detectViewMode(List<DebugEvent> events) → DebugViewMode
Chế độ xem mà luồng gần nhất thuộc về — mặc định "Tự động" của panel.
distinctGlyphColor(String key) → String
Màu cố định theo khoá (id marker) — đúng getDistinctPlaceColor của mymap: băm (h·31 + mã) & 0xffffffff có dấu 32 bit như JS, góc vàng 137.508°, hsl(h, 68%, 45%) → hex #RRGGBB.
downloadOfflineRegion(OfflineRegionDefinition definition, {Map<String, dynamic> metadata = const {}, dynamic onEvent(DownloadRegionStatus event)?}) → Future<OfflineRegion>
Downloads the region described by definition for offline use and completes with it once the region is created, before its tiles are in.
durationFromSpeed(double? speed) → Duration
Quy đổi speed của MapLibre (hệ số tốc độ bay) sang Duration của Flutter.
encodeNestedArrays(Object? value) → Object?
Firestore không lưu mảng lồng mảng (route coordinates: [[lng, lat], …], alternatives[].coordinates): phần tử là mảng được bọc { "$a": [...] } khi ghi và mở lại khi đọc — đệ quy, mọi chỗ trong doc. Hợp đồng lưu trữ chung với adapter web (component_memory_sync.md mục 4).
exportOfflineDatabase(String destinationPath) → Future<String?>
Writes a copy of the offline database to a path of your choosing, file name included, for example '${(await getTemporaryDirectory()).path}/regions.db'. The parent directory of destinationPath must already exist.
filterProperties(Object? properties, {required Set<String> whitelist, bool allowAll = false, int maxKeys = 20}) → Map<String, dynamic>
Giữ thuộc tính được phép: allowAll (layer của chính AI — AI tự viết ra chúng) hoặc tên nằm trong whitelist. Chỉ giữ giá trị vô hướng.
followCameraDelta(String mode, double x, double y, double width, double height) → List<double>
Độ dời tâm camera (px logic) cho follow (15.4) — center: tới marker; edge: chỉ khi marker cách mép < kAnimationFollowEdgePx, vừa đủ để về lại khoảng đó. Không làm tròn: camera trôi mượt lẻ pixel theo xe (làm tròn theo pixel thiết bị thì xe chậm làm cả bản đồ nhích từng nấc).
followPitch(double currentPitch) → double?
Pitch cần đặt khi camera theo xe: kFollowPitchEpsilon nếu đang đúng 0, ngược lại không đụng (null).
formatMentionNumber(num n) → String
Định dạng số như widget (formatNumber — Intl.NumberFormat('en-US', {maximumFractionDigits: 1})): nhóm nghìn bằng dấu phẩy, thập phân bằng dấu chấm, tối đa 1 chữ số thập phân, cùng một kiểu cho vi lẫn en.
formatRating(num r) → String
Điểm hiện một chữ số thập phân (4.6, 5.0).
formatRatingCount(num n) → String
ratingCount rút gọn (components doc 8.2): dưới 1000 giữ nguyên, 2100 → 2.1k, 1250000 → 1.3M.
formatTrackingDistance(double? km) → String
generateEntityId(BatchOrigin origin, String kind, {int? nowMs}) → String
Sinh id mới {origin}-{kind}-{ms 13 chữ số}{số thứ tự 4 chữ số}. Đơn điệu tăng trong một tiến trình: cùng ms thì tăng số thứ tự; quá 9999 trong một ms thì mượn ms kế tiếp — không bao giờ trùng.
getBearing(List<double> start, List<double> end) → double
Góc phương vị từ start nhìn sang end, trong khoảng [0, 360) độ, tính theo chiều kim đồng hồ từ hướng Bắc.
getBuildingsSourceId(String id, {String namespace = 'buildings', BatchOrigin origin = BatchOrigin.app}) → String
getDistance(List<double> coord1, List<double> coord2) → double
Khoảng cách giữa 2 toạ độ [lng, lat] theo công thức Haversine (km).
getFleetCommandIds({String namespace = 'crm-vehicle-tracking', BatchOrigin origin = BatchOrigin.app}) → FleetCommandIds
getFleetImageId(String url, {String namespace = 'crm-vehicle-tracking', BatchOrigin origin = BatchOrigin.app}) → String
getHistoryProgressPercent(double progressMs, double totalDurationMs) → double
getHistoryTrajectoryCommandIds(String id, {String namespace = 'crm-history', BatchOrigin origin = BatchOrigin.app}) → RouteCommandIds
getImageCommandId(String name, {String namespace = 'images', BatchOrigin origin = BatchOrigin.app}) → String
Stable managed id for a named app image.
getInterpolatedPoint(List<List<double>> points, double targetDistanceKm) → InterpolatedPoint
Nội suy toạ độ tại quãng đường targetDistanceKm dọc theo points.
getListOfRegions() → Future<List<OfflineRegion>>
Lists the offline regions stored on the device.
getOfflineDatabasePath() → Future<String?>
Returns the absolute path of the offline database backing the offline packs and the ambient cache, or null if it cannot be resolved.
getOfflineRegionStatus(int id) → Future<OfflineRegionStatus>
Gets the current download status of an offline region.
getPathLength(List<List<double>> points) → double
Tổng độ dài (km) của một polyline.
getPlannedRouteCommandIds(String id, {String namespace = 'crm-planned-route', BatchOrigin origin = BatchOrigin.app}) → RouteCommandIds
getPolygonCommandIds(String id, {String namespace = 'polygons', BatchOrigin origin = BatchOrigin.app}) → PolygonCommandIds
getRandomString([int length = 10]) → String
getSharemapLayerIds() → List<String>
Id mọi layer thuộc source sharemaplayers, đọc tĩnh từ ShareMapLayerIds thay vì getStyle() — tránh phụ thuộc style đã load xong hay chưa, và tránh một round-trip platform channel nặng cho mỗi lần query.
getTrackingMarkerSourceId({String namespace = 'crm-tracking-markers', BatchOrigin origin = BatchOrigin.app}) → String
glyphBoxPx(String name, double diameter, GlyphStyle t) → int
Cạnh hộp glyph (px logic) trong hình tròn Ø diameter.
glyphColor(String name) → String?
Màu của loại; location hay tên lạ → null.
glyphImageId(String glyph, String color, num diameter, GlyphStyle style, Map<String, dynamic>? border) → String
sm-glyph-{tên}-{màu}-{Ø} (+ -s{băm token} khi token lệch sharemap,
glyphSvgMarkup({required String glyph, required String color, required num size, GlyphStyle style = GlyphStyle.fallback}) → String
SVG của icon glyph — cùng hình ảnh engine vẽ trên bản đồ (tròn nền, vòng trong, nhóm glyph nhân độ đục). Tên lạ → location. Dùng cho app vẽ ngoài bản đồ (danh sách place, web view, server) để bản đồ và danh sách cùng một nguồn; trùng từng ký tự với glyphSvgMarkup của bản React. Trong Flutter dùng widget GlyphIcon (vector, không cần package SVG).
hashObject(Object? obj) → String
FNV-1a 32-bit hash cho object/GeoJSON/style. Trả chuỗi hex 8 ký tự.
haversineMeters(LngLat a, LngLat b) → double
Khoảng cách mặt đất giữa hai điểm [lng, lat] (mét, haversine).
importWireKey(String base64UrlKey) → SecretKey
Key nhận từ /wire-key: base64url không padding, đúng 43 ký tự = 32 byte.
installOfflineMapTiles(String tilesDb) → Future<void>
Copies the tiles database tilesDb, an absolute path or a Flutter asset, in place of the offline database, so its tiles are available offline.
interpolateByTime(TimeIndex index, double t) → TrajectorySample
Nội suy vị trí + hướng tại thời gian ảo t (Unix epoch ms). Kẹp về điểm đầu/cuối khi t nằm ngoài dải.
isAllowedIconUrl(Object? url, Set<String> allowedHosts) → bool
Cổng bảo mật cho iconUrl do AI cung cấp (§5.2 rule 2, §5.6.3 protocol).
isCameraEqual({required List<double> currentCenter, required double currentZoom, required List<double> targetCenter, double? targetZoom, double currentBearing = 0, double? targetBearing, double currentPitch = 0, double? targetPitch, double epsLngLat = 0.0001, double epsZoom = 0.05}) → bool
Hai trạng thái camera có coi là bằng nhau trong sai số cho phép không.
isDebugConsoleAttached() → bool
Đang có console logger nào được gắn hay không.
isLayersTokenHost(String? host) → bool
Host có phải layers.sharemap.live hay không.
isManagedId(Object? id, [List<String>? kinds]) → bool
true nếu id đúng định dạng và (khi khai) kind thuộc kinds.
isSharemapHost(String? host) → bool
Host có thuộc ShareMap hay không.
isSyncedEntry(ComponentEntry e) → bool
Entry có đi qua kênh đồng bộ không (mục 3): id ai-*, hoặc app-* mang tag shared; điểm dừng (stopOf) sống trong stops[] của route nên không có doc riêng.
isTilesTokenHost(String? host) → bool
Host có hiểu tiles token hay không.
jsonByteLength(Object? value) → int
Byte JSON thu gọn của value.
layerIdFor(String sourceId, String role) → String
Id layer thuộc một source managed: {sourceId}-{vai}.
loadSharemapClientInfo({ClientInfoSource? source}) → Future<SharemapClientInfo?>
Đọc thông tin client, cache cho cả vòng đời tiến trình.
markerDisplayName(Map<String, dynamic> config) → String?
Tên người đọc của một marker (cấu hình config) — một quy tắc cho ô @ lẫn thẻ lộ trình: properties.name → ariaLabel → nhãn chữ. Điểm dừng Fleet vẽ bỏ trống label (hoặc mang số thứ tự) còn tên thật ở properties.name / ariaLabel, nên nhãn toàn số không phải tên. Không có gì → null (không gợi ý).
mentionableComponents(ComponentMemory memory, {ComponentMentionStrings strings = ComponentMentionStrings.vi, DescribeComponent? describe}) → List<ComponentMentionCandidate>
Gợi ý @mention (§4.1): mọi marker / route (cả route lồng trong kế hoạch) / trip-plan, và popup không neo vào marker; có tên theo §3.3; kể cả component đang ẩn; mọi origin. Không có animation. Thứ tự = thứ tự trong sổ.
mentionMarkerLabelText(Object? label) → String?
Chữ của label marker: chuỗi hoặc label.title (thẻ nhãn 1.4), qua normalizeMentionLabel; không thì null.
mergeOfflineRegions(String path) → Future<List<OfflineRegion>>
Imports the regions of the offline database at path, for example one written by exportOfflineDatabase on another device, and returns them.
nestPlans(List<SyncDoc> docs) → ({List<Map<String, dynamic>> items, List<String> waiting})
Dựng items của MỘT component.add từ các doc (mục 6, snapshot đầu): sắp (seq, itemIndex), lồng route có planOf vào kế hoạch theo routeIds. Kế hoạch còn thiếu route doc → waiting (chưa add được — route tới sau).
newMapAgentRequestId() → String
requestId mới cho một lượt: req-<ms base36>-<8 ký tự ngẫu nhiên> — đủ khác nhau trong một phiên, không cần đồng bộ với agent.
normalizeMentionLabel(Object? v) → String?
Chuẩn hoá mọi nhãn mention (token chèn vào ô nhập, label của reference, label của stop / ngày): cắt hai đầu, gộp mỗi chuỗi khoảng trắng thành một dấu cách, trần kMentionLabelMax (đơn vị UTF-16, như lib React). Kết quả bất biến qua normalizeReferences và chuẩn hoá phía Fleet — nên token người dùng thấy trong câu hỏi trùng đúng label agent nhận. Rỗng / không phải chuỗi → null.
normalizeReferences(Iterable<ComponentReference> refs) → List<ComponentReference>
Chuẩn hoá trước khi gửi: bỏ mục sai / trùng id (giữ mục đầu), cắt chuỗi + số lượng theo giới hạn schema (≤ kReferencesMax mục), cả mảng ≤ kReferencesMaxBytes byte UTF-8 — vượt thì cắt điểm dừng từ mục cuối trước, hết điểm dừng thì bỏ mục cuối. Id không bao giờ bị cắt (cắt sẽ trỏ nhầm đối tượng): dài quá trần thì bỏ mục / bỏ trường. Không sửa đầu vào.
normalizeText(String? input) → String
Chuẩn hoá chuỗi để so khớp lỏng: hạ chữ thường + bỏ dấu tiếng Việt.
openWire(SecretKey key, Uint8List wire, {required int maxJson}) → Future<Uint8List>
byte wire → byte JSON. maxJson là trần byte JSON sau giải nén, kiểm trong lúc giải nén (chống bom).
originOfComponentId(String id) → String
Origin theo tiền tố id (ai-* → ai, còn lại app) — origin lúc tạo.
originOfId(String id) → String
origin của một id trong mapContext (§3.3): theo tiền tố.
paintGlyphIcon(Canvas canvas, {required String glyph, required Color color, required double diameter, GlyphStyle style = GlyphStyle.fallback}) → void
Tròn đặc Ø diameter màu color, vòng trong ring (tâm nét ở r − widthPx/2), glyph vẽ vector trong một lớp riêng nhân glyphOpacity — nét khoét (tone: "bg") tô màu nền nên không lộ trắng. Gốc toạ độ ở góc trên trái hình vuông bao. Vector: nét theo mật độ điểm ảnh của canvas. Tên glyph lạ → location.
parseCssColor(Object? value) → Color?
Màu CSS thường gặp (#rgb, #rrggbb, #rrggbbaa, rgb(), rgba(), vài tên); null nếu không đọc được.
parseLayerId(Object? layerId) → ({String role, String sourceId})?
Tách id layer {sourceId}-{vai}; null nếu phần đầu không phải sourceId hợp lệ hoặc vai sai khuôn. sourceId có độ dài cố định theo kind, nên tách được mà không mơ hồ.
parseManagedId(Object? id) → ParsedManagedId?
Tách id managed thành ba phần; null nếu sai định dạng.
parseServerSentEvents(Stream<List<int>> bytes) → Stream<SseEvent>
Byte text/event-stream → sự kiện, chịu được ranh giới chunk tuỳ ý (giữa ký tự UTF-8 nhiều byte, giữa CR và LF, giữa dòng). Byte UTF-8 sai → lỗi FormatException. Huỷ subscription thì huỷ ngay stream nguồn (chuỗi transformer, không dùng async* — generator đang chờ ở await for chỉ nhận lệnh huỷ ở yield kế tiếp, tức là không bao giờ nếu nguồn im lặng).
parseSvgPathData(String d) → Path
Bộ đọc d của SVG path đủ cho tập icon trên và icon tourist-point: M L H V C S A Z (hoa / thường), lệnh lặp ngầm, số dính nhau (1.05.22, -.78).
pauseOfflineRegionDownload(int id) → Future<void>
Pauses an in-progress offline region download.
payloadsOf(DebugEvent e) → List<DebugPayload>
Các khối JSON đáng xem của một event, theo thứ tự hiển thị.
planItem(Map<String, dynamic> planConfig, List<Map<String, dynamic>> routes) → Map<String, dynamic>
Phần tử trip-plan đủ: cấu hình doc bỏ routeIds, mang routes lồng.
pointInPolygon(List<double> point, List<List<List<double>>> polygon) → bool
Điểm-trong-đa-giác cho Polygon (ring 0 là biên ngoài, các ring sau là lỗ).
pointInRing(List<double> point, List<List<double>> ring) → bool
Ray casting (even-odd) — điểm có nằm trong ring không.
popupActionIconPath(String name) → Path?
Path của icon nút trong hệ toạ độ 24×24, null nếu tên lạ.
popupAnchorPlacement(String anchor, PopupOffsetSides sides, double s) → (Offset, Offset)
(dịch điểm neo, dịch theo kích thước thẻ) cho từng anchor — anchor là phía của thẻ gắn vào toạ độ. Đỉnh mũi tên nằm đúng khoảng của phía đó cách điểm (sides: popup trên điểm dùng up, dưới down, bên phải right, bên trái left): cạnh thẻ cách thêm s; hướng góc dời ngang 14 + s để mũi tên (cách mép 14) thẳng điểm (components doc 8.2 / 8.5, như bản web).
popupAutoAnchor(Offset p, Size map, Size card, double reach) → String
anchor: auto theo đúng thuật toán của maplibregl.Popup: thiếu chỗ phía trên điểm thì thẻ nằm dưới (top), sát đáy thì nằm trên (bottom); sát mép trái / phải thì thêm -left / -right. reach = offsetPx + s.
popupFontWeight(Object? w) → FontWeight?
weight 100..900 → FontWeight.
popupPairs(Iterable<Map<String, dynamic>> citations) → Map<String, String>
Map id marker → id popup từ các citation mang đúng một cặp marker + popup.
querySharemapPois(MapLibreMapController controller, Size? viewportSize, {List<String>? layerIds}) → Future<List<Poi>>
Đọc POI đang hiển thị trong khung nhìn hiện tại, gộp trùng theo id và sắp xếp theo tên. Trả list rỗng khi không có layer POI nào hoặc chưa biết kích thước.
readItinerary(ShareMapEngine engine) → Itinerary?
Lịch trình đang hiện trên bản đồ, hoặc null nếu chưa có điểm dừng nào (hoặc engine chưa đăng ký ComponentEngine).
repairOf({required bool retryable, required String reason, List<String>? achievableBy, List<Object>? allowed, num? limit, num? actual, List<String>? available, String? hint}) → Map<String, dynamic>
Dựng $defs/Repair.
resetMissingSecretWarning() → void
resetOfflineDatabase() → Future<void>
Resets the entire offline database: deletes every offline region and clears the ambient cache. Use with care: offline regions cannot be recovered afterwards.
resolveAgentOptions({required ShareMapEngine? engine, required MapLibreMapController? controller, required MapAiOptions? ai, required List<Poi> defaultQueryPois(), GeomeshClient? defaultGeomesh}) → AiShareMapAgentOptions?
Ghép option cho AiShareMapAgent từ controller + engine + cấu hình ai.
resolveCitation(ShareMapEngine engine, Map<String, dynamic> c) → CitationTarget?
Đích của citation c trên bản đồ hiện tại; null khi mọi thứ nó trỏ tới đã không còn.
resolveTileAuth({required String url, String? apiKey, String? secretKey, TilesTokenSource? tokenSource, TilesTokenSource? layersTokenSource, TilesTokenSigner? signer}) → TileAuth
Chọn cách xác thực cho MỘT request tile.
resolveUiLocale(String? tag) → String
BCP 47 → ngôn ngữ hỗ trợ theo phần ngôn ngữ chính (en-US → en, vi_VN → vi); ngôn ngữ khác lùi về kDefaultUiLocale.
resumeOfflineRegionDownload(int id) → Future<void>
Resumes a paused offline region download.
ringAreaSquareMeters(List<List<double>> ring) → double
Diện tích (m²) của một ring [[lng,lat], …] theo công thức spherical excess. Sai số < 0,1% ở quy mô đô thị — đủ cho câu trả lời của agent.
roundCoordinate(num value, [int decimals = 5]) → double
Làm tròn toạ độ về decimals chữ số thập phân (pipeline nén L3, §4.4 protocol).
sanitizeTranscript(List<ChatMessage> messages) → List<ChatMessage>
Sửa transcript nạp từ store để nó không bao giờ đặt LLM vào trạng thái hội thoại không hợp lệ:
scopedEntityId(BatchOrigin origin, String kind, String namespace, String name) → String
sealWire(SecretKey key, List<int> json, {List<int>? iv}) → Future<Uint8List>
byte JSON → [0x01][IV 12][AES-256-GCM(deflate-raw(json)) + tag 16].
setHttpHeaders(Map<String, String> headers) → Future<void>
Sets HTTP headers that are injected into every network request MapLibre makes (tile fetches, style JSON, sprites, glyphs).
setMaximumAmbientCacheSize(int bytes) → Future<void>
Sets the size limit, in bytes, of the ambient cache: the tiles and style resources the map keeps on disk from normal browsing. The default is 50 MB and 0 turns the cache off. Offline regions do not count towards the limit.
setOffline(bool offline) → Future<void>
Forces MapLibre offline, or gives the network state back to the system.
setOfflineMaxConcurrentRequests({int? maxRequests, int? maxRequestsPerHost}) → Future<void>
Sets the maximum number of concurrent HTTP requests for tile downloads.
setOfflineTileCountLimit(int limit) → Future<void>
Caps the number of tiles a single offline region download may store. A download that would need more ends with an Error event whose code is TILE_COUNT_LIMIT_EXCEEDED, and the region is deleted.
stableEntityId(BatchOrigin origin, String kind, String key) → String
Id ổn định cho một khoá nội bộ (tên tài nguyên của tool/builder): sinh MỘT lần bằng generateEntityId rồi giữ suốt vòng đời tiến trình, nên gọi lại với cùng khoá upsert đúng tài nguyên cũ thay vì tạo bản sao. Khoá không lộ ra id — id không mang nghĩa nghiệp vụ.
stageDetailOf(DebugEvent e) → String?
Chủ thể cụ thể của chặng đang sáng, để dán vào ô được highlight trong sơ đồ: ô Tool hiện Tool · geomesh_search, Geomesh API hiện GET /search.
stageForEvent(DebugEvent e) → FlowStage
Chặng trong sơ đồ luồng mà event này đại diện.
startComponentSync(ComponentSyncEngine engine, ComponentSyncTransport transport, {ComponentSyncErrorCallback? onError, void onStatus(ComponentSyncStatus status)?}) → ComponentSyncStop
Gắn bộ máy đồng bộ lên engine qua transport — ComponentEngine.sync.
summarizeRenderedFeatures(List<Object?> raw, {required Set<String> whitelist, bool allowAllProperties = false, List<Object> selected = const []}) → LayerDigest?
L2 — digest một layer từ feature đang render (§4.6). null khi không có feature nào (layer không render trong khung — không tốn token cho nó).
supportedMapAgentCommands(ShareMapEngine engine) → List<String>
Lệnh khai trong capabilities.commands[]: đúng những gì engine thật sự chạy được (§9.10 #1 — khai thừa là lỗi nặng nhất). component.* chỉ có khi engine đã cắm ComponentHandler; feature.* chỉ trên web.
toChatBubbles(List<ChatMessage> messages, List<AgentStep> lastSteps) → List<ChatBubble>
Biến transcript của agent → danh sách bong bóng, kèm fallback khi model bỏ qua câu kết.
toDocBody(Map<String, dynamic> exported, ComponentEntry e, ComponentMemory memory) → SyncDocBody
Thân doc từ cấu hình đã gộp lớp phủ (exported = exportOf(id)) + bản ghi trong sổ. Kế hoạch: routes → routeIds (theo day). Popup: bỏ open — mở / đóng thẻ là trạng thái của từng người xem, không ép lên máy khác.
toHistoryTrajectoryCommandDto(Object entityId, Iterable<Map<String, dynamic>> samples, {String? label, String? iconUrl, bool showLabel = false, TrajectoryPlaybackOptions playback = const TrajectoryPlaybackOptions()}) → HistoryTrajectoryCommandDto?
Sorts timestamps, removes invalid samples, keeps the last duplicate sample.
toTrackingVehicleCommandDto(Map<String, dynamic> row) → TrackingVehicleCommandDto?
Invalid rows return null; optional metadata stays JSON, with no network calls.
toTrackingVehicleCommandDtos(Iterable<Map<String, dynamic>> rows) → List<TrackingVehicleCommandDto>
updateOfflineRegionMetadata(int id, Map<String, dynamic> metadata) → Future<OfflineRegion>
Replaces the metadata of the offline region with the given id and returns the updated region.
validateAction(MapAction action, [ValidationContext ctx = const ValidationContext()]) → ValidationError?
Validate một action (Pha A). null = hợp lệ.
validateAgainstSchema(Object? value, Map<String, dynamic> schema, {String path = ''}) → List<SchemaViolation>
Validate value theo schema. Trả danh sách rỗng khi hợp lệ.
validateBatchJson(Map<String, dynamic> json) → ValidationError?
Validate khung của một 2 đọc từ mạng, trước khi thực thi bất kỳ action nào. Trả null khi hợp lệ; lỗi thì cả batch bị rejected (§7.1).
validateExpressionDepth(Object? expr, {int maxDepth = 5, int currentDepth = 1}) → bool
Giới hạn độ sâu lồng nhau của MapLibre expression (§9.8 protocol, mặc định 5). Chặn expression bệnh hoạn gây tốn CPU khi render.
validateHistoryRange(DateTime? start, DateTime? end, {Duration maxRange = const Duration(days: 7)}) → String?
The host owns data fetching. Returns null for an accepted range.
validateTrajectory(TrajectoryPath path) → TrajectoryValidation
Kiểm tra trajectory theo §5.6.5 bước 2. Sai → caller cảnh báo và vẫn render tĩnh (không ném lỗi, không phá batch).
visibleCorners(Future<LatLng> toLatLng(Point<double> screen), Size size, double ratio) → Future<List<List<double>>?>
camera.corners (sharemap-context.md 4.1): chiếu bốn góc viewport size (pixel logic) ra toạ độ — trên-trái, trên-phải, dưới-phải, dưới-trái. ratio đổi sang đơn vị màn hình của nền tảng (Android: pixel vật lý). Làm tròn 5 chữ số, lng gói về -180, 180, lat kẹp -90, 90. null khi viewport rỗng, phép chiếu lỗi hoặc trả số không hữu hạn.
warnMissingSecretKey(String what, {void onWarn(String)?}) → void
Cảnh báo khi chỉ có xApiKey mà không có secretKey.
withClientHeaders(Map<String, String> base, {ClientInfoSource? source}) → Future<Map<String, String>>
Trộn header nhận dạng vào một bộ header sẵn có.
withoutImageUrlFields(Map<String, dynamic> schema) → Map<String, dynamic>
dataSchema bỏ mọi trường format: "image-url" (cả trong required) — AI không tự đặt URL ảnh (mục 9).

Typedefs

ComponentSyncErrorCallback = void Function(String message, Object? err)
Lỗi không chặn (ghi bị từ chối, doc hỏng bị bỏ qua, nghe lỗi).
ComponentSyncStop = void Function({bool keepComponents})
Hàm dừng đồng bộ. Mặc định gỡ khỏi bản đồ mọi component đã đồng bộ của kho đó (đổi map → không sót component của map cũ); keepComponents true (dispose widget) chỉ huỷ nghe.
DebugPrinter = void Function(String line)
Hàm in — cho phép inject fake khi test.
DescribeComponent = Map<String, Object?>? Function(String id, ComponentReference base)
Host bổ sung dữ liệu app biết (ngày thật, địa chỉ…) cho component id (component-mentions-design §4.4). Trả phần reference dạng map (khoá như toJson() của ComponentReference: kind, address, day, date, startDate, days…; giá trị có thể là JSON hoặc chính ReferenceStop / TripPlanDayReference) hoặc null = dùng phần lib dựng.
MapAgentMessageDeltaCallback = void Function(String text, {bool done})
Một khung message_delta (§9.1.3 "Trả lời hai pha"): text là mẩu chữ nối tiếp mẩu trước (token streaming) — hoặc nguyên câu một lần; done true ở mẩu cuối: chữ của model đã hết, từ đây tới batch_end chỉ còn phần bản đồ (định vị, tính tuyến, soạn [2]). Mẩu cuối có thể rỗng ({ text: "", done: true }).
MapAgentMessageDraftCallback = void Function(String draft, {bool done})
aiMessage đang ghép từ các message_delta của batch đang tới (draft là chuỗi đã nối tới giờ, bắt đầu lại ở mỗi vòng); done true khi agent báo chữ của model đã hết (§9.1.3 "Trả lời hai pha").
MapAgentProgressCallback = void Function(MapAgentProgress progress)
MapAgentReferencesBuilder = List<ComponentReference> Function()
Dựng references của một câu (component-mentions-design §4.2) — gọi đúng một lần, lúc câu thật sự gửi (không phải lúc xếp hàng): marker có thể đã bị kéo, component đã bị xoá trong lúc chờ.
MapCreatedCallback = void Function(MapLibreMapController controller)
OnCameraIdleCallback = void Function()
OnCameraMoveCallback = void Function(CameraPosition cameraPosition)
OnCameraMoveStartedCallback = void Function(CameraMoveReason reason)
OnCameraTrackingChangedCallback = void Function(MyLocationTrackingMode mode)
OnCameraTrackingDismissedCallback = void Function()
OnFeatureDragCallback = void Function(Point<double> point, LatLng origin, LatLng current, LatLng delta, String id, Annotation? annotation, DragEventType eventType)
A step of a feature drag. id is the feature id as text, such as '2' for the id 2, on every platform.
OnFeatureHoverCallback = void Function(Point<double> point, LatLng coordinates, String id, Annotation? annotation, HoverEventType eventType)
The mouse entering, moving over or leaving a feature, on web. id is the feature id as text, such as '2' for the id 2.
OnFeatureInteractionCallback = void Function(Point<double> point, LatLng coordinates, String id, String layerId, Annotation? annotation)
A tap on a feature of an interactive layer. id is the feature id as text, such as '2' for the id 2, on every platform. annotation is the annotation the feature belongs to, or null for a feature of your own layers.
OnMapClickCallback = void Function(Point<double> point, LatLng coordinates)
OnMapIdleCallback = void Function()
OnMapLongClickCallback = void Function(Point<double> point, LatLng coordinates)
OnMapMouseMoveCallback = void Function(Point<double> point, LatLng coordinates)
OnPlatformViewCreatedCallback = void Function(int)
OnStyleLoadedCallback = void Function()
OnUserLocationUpdated = void Function(UserLocation location)
RemoteChangesCallback = void Function(List<RemoteChange> changes, bool initial)
Nghe kho chung: initial true ở lần đầu — mang mọi doc hiện có.
ShareMapMarkerTemplateRenderer = Future<Uint8List> Function(Map<String, dynamic> data)
Vẽ ảnh marker từ data — trả PNG (ảnh tĩnh, không tương tác). Engine gọi một lần cho mỗi bộ data khác nhau và dùng chung ảnh (mục 9).
ShareMapPopupTemplateBuilder = Widget Function(BuildContext context, Map<String, dynamic> data, ShareMapTemplateContext ctx)
Dựng thân popup từ data — widget Flutter, có tương tác. Hiện dữ liệu bằng Text (không bao giờ diễn giải thành code / HTML).
SpriteLookup = SpriteSlice? Function(String name)
Tra icon trong atlas sprite nền; null = chưa có.
SpriteSlice = ({Image image, double pixelRatio, Rect rect})
Một ô của atlas sprite: ảnh atlas + vùng của icon + tỉ lệ điểm ảnh của atlas.
SyncDocBody = ({AdoptedStamp? adopted, Map<String, dynamic> config, SyncDocMeta meta, String origin, int v, bool visible})
Phần thân doc bộ máy dựng từ sổ — chưa có batch / createdBy / by.
TilesTokenSigner = String Function({required String apiKey, required String method, required String secretKey, required Uri uri})
Ký credential cho một request.
TransformRequestCallback = FutureOr<RequestParameters> Function(String url, ResourceType resourceType)
ViewportSizeProvider = Size? Function()
Nguồn cung cấp kích thước viewport (pixel) cho query.renderedFeatures, digest và camera.sizePx.

Exceptions / Errors

ComponentThemeError
Theme hỏng — schema, extends không giải được, thiếu default, quá trần. Engine ném lỗi này lúc nạp và không áp một phần.
MapAgentErrorFrameException
Agent phát khung error giữa stream (§9.1.4). code là mã của agent — thường AGENT_UNAVAILABLE (LLM/provider hỏng) hoặc RATE_LIMITED (vượt hạn mức: chờ rồi mới hỏi lại), cũng có thể SUPERSEDED… (§7.2).
MapAgentException
Lỗi gốc của remote agent. code là mã máy đọc được.
MapAgentHttpException
Lỗi tầng HTTP — agent "không trả lời được", khác hẳn agent "bảo không làm gì" (§9.1.2). body là JSON (hoặc chuỗi) đã giải mã nếu có.
MapAgentPayloadTooLargeException
Gói vượt trần byte (§9.6.1). actual có thể chỉ là "đã vượt" (số byte đọc được tới lúc dừng), không phải kích thước thật.
MapAgentStreamException
Stream hỏng: đứt trước batch_end, sai thứ tự, index thủng/lộn, actionCount lệch, khung sai hình dạng. code luôn là STREAM_INCOMPLETE (§9.1.3: lệch nào cũng "xử lý như đứt stream"). Lượt hỏng; client chỉ thực thi khi đã có trọn batch_end nên không có action nào đã chạy, không có [3] nào phải gửi.
ShareMapLocationException
Exception thrown when a background location command cannot complete.
SMComponentError
Lỗi của một command component: giữ result và data.errors của action hỏng.
TrackingCommandException
A failed or partially applied batch. The full protocol result is available.
WireError
Lỗi codec: code là WIRE_MALFORMED hoặc PAYLOAD_TOO_LARGE.