Initial flame_lua_runtime package

This commit is contained in:
gem
2026-06-07 22:53:58 +08:00
commit 733b2fb798
262 changed files with 28439 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
class RuntimeEvent {
const RuntimeEvent({
required this.type,
this.target,
this.handler,
this.x,
this.y,
this.data = const {},
this.sessionId,
this.scope,
this.targetEpoch,
this.scopeEpoch,
});
final String type;
final String? target;
final String? handler;
final double? x;
final double? y;
final Map<String, Object?> data;
/// Runtime-internal lifecycle session. Not exposed to Lua.
final int? sessionId;
/// Runtime-internal lifecycle scope. Not exposed to Lua.
final String? scope;
/// Runtime-internal target node epoch. Not exposed to Lua.
final int? targetEpoch;
/// Runtime-internal scope node epoch. Not exposed to Lua.
final int? scopeEpoch;
RuntimeEvent withLifecycle({
int? sessionId,
String? scope,
int? targetEpoch,
int? scopeEpoch,
}) {
return RuntimeEvent(
type: type,
target: target,
handler: handler,
x: x,
y: y,
data: data,
sessionId: sessionId ?? this.sessionId,
scope: scope ?? this.scope,
targetEpoch: targetEpoch ?? this.targetEpoch,
scopeEpoch: scopeEpoch ?? this.scopeEpoch,
);
}
Map<String, Object?> toMap() {
return {
'type': type,
if (target != null) 'target': target,
if (handler != null) 'handler': handler,
if (x != null) 'x': x,
if (y != null) 'y': y,
if (data.isNotEmpty) 'data': data,
};
}
}