GameBridgeSession class
Typed dispatch for skin bridge messages. Owns request/reply pairing
(result/error by id), the motion streams, and the native→skin pushes
(viewport, device, lifecycle, motionSample). The host supplies the
platform-bound effects; every branch degrades to a log or an error reply,
never a throw.
Constructors
-
GameBridgeSession({required GameBridge bridge, required String initJson(), required GameAsyncRunner async, required Future<
GameHttpOutcome> httpCall(String method, String path, Map<String, dynamic> ? body), required GameSkinStorage? storage, required String storageNamespace, required void haptics(String style), required GameMotionSource sensors, required void onLog(String level, String message), required void onCloseRequest(String style), void onCta(String op)?, void onHttpAnswer(String path, Map<String, dynamic> ? requestBody, Map<String, dynamic> ? responseBody)?, GameHealthContext health = GameHealthContext.empty, void onHealth(EngageAnalyticsEvent event)?, required void send(String style), Future<void> runActionSteps(List<EngageAction> actions)?, EngageActionParser actionParser = const EngageActionParser(), void onHttpTimeout(String path, int durationMs)?, GameWatchdogSchedule? watchdogSchedule, GameWatchdogCancel? watchdogCancel})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void -
The surface is gone: fail every in-flight request as
closed, pause the skin, then end every stream. Idempotent. -
handleEnvelope(
BridgeEnvelope env) → void - One pre-parsed envelope through typed dispatch. Never throws.
-
handleMessage(
String raw) → void - One raw skin string through typed dispatch. Never throws.
-
handleUnparseable(
String raw) → void -
One raw skin string that did not parse. A request with an id but no type
answers
bad_request; anything else is a quiet drop, flagged once. Oversize messages count as a drop even when they carry an id. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDeviceChanged(
GameDeviceInfo info) → void - Fresh device facts from the host; pushes when the pushed subset changed.
-
onPaused(
) → void -
onResumed(
) → void -
onViewportChanged(
double width, double height, GameSafeArea safeArea) → void - Latest viewport from the host; pushes when it changed since the last push.
-
sendInit(
) → void -
Sends
initnow (on page load, beforeready). Never throws. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isOpenableLink(
String url) → bool -
Web links need a host; app deep links (
medihub://cart) only a safe scheme. Browsers drop control characters inside a scheme (java\nscript:), so this does too before parsing. Port of AndroidGameLinkPolicy(check and open decide on the same canonical string). -
openableLink(
String raw) → String? -
The validated URL for
raw, or null. Strips C0 controls, DEL and C1 (0x00-0x1F,0x7F,0x80-0x9F) first, so the check and the open decide on the same canonical string. Never throws.
Constants
-
blockedLinkSchemes
→ const Set<
String> - Schemes that would run code, read local data or bypass link routing.
- maxSkinErrorsPerOpen → const int
-
Skin
errorlogs reported per open at most. -
repliedTypes
→ const Set<
String> - Types that always answer exactly once when they carry an id.