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