trackSwiftCreation static method

void trackSwiftCreation(
  1. SwiftValue swift,
  2. String? name
)

Track SwiftValue creation (only called when enabled) Internal use only - called from SwiftValue constructor

Implementation

static void trackSwiftCreation(SwiftValue<dynamic> swift, String? name) {
  if (!_enabled || !_trackDependencies) return;

  final id = getSwiftId(swift);
  _swiftRegistry[id] = _SwiftInfo(
    id: id,
    name: name ?? swift.runtimeType.toString(),
    type: swift.runtimeType.toString(),
    createdAt: DateTime.now(),
  );

  // Store reference for state inspector
  _swiftRefs[id] = swift;

  _stateNodes[id] = _StateNode(
    id: id,
    type: 'SwiftValue',
    name: name ?? swift.runtimeType.toString(),
  );
}