addJavascriptCode method
Implementation
@override
Future<void> addJavascriptCode(String code) async {
await _ensureBridgeInitialized();
try {
final scriptElement = web.HTMLScriptElement()
..type = 'text/javascript'
..text = code;
web.document.head?.appendChild(scriptElement);
} catch (e) {
throw Exception('Failed to add JavaScript code: $e');
}
}