/// 内部桥接层:解除 widget 对 AnalyticsSdk 的直接依赖。 /// /// AnalyticsSdk.init() 调用 [register] 注册实现; /// widget 层通过此类的静态方法访问 SDK 能力, /// 无需 import analytics_sdk.dart,避免上行依赖。 class WidgetBridge { static void Function(dynamic event)? _track; static String Function()? _getUserType; static bool _enableDebugBanner = false; static List> Function()? _getDebugSteps; /// 由 AnalyticsSdk.init() 调用,注册 SDK 实现 static void register({ required void Function(dynamic event) track, required String Function() getUserType, required bool enableDebugBanner, required List> Function() getDebugSteps, }) { _track = track; _getUserType = getUserType; _enableDebugBanner = enableDebugBanner; _getDebugSteps = getDebugSteps; } static void track(dynamic event) => _track?.call(event); /// 获取当前用户类型,SDK 未初始化时返回 'normal'。 static String getUserType() => _getUserType?.call() ?? 'normal'; static bool get enableDebugBanner => _enableDebugBanner; static List> getDebugSteps() => _getDebugSteps?.call() ?? []; }