runJavascriptReturningResult method

  1. @override
Future<String> runJavascriptReturningResult(
  1. String javascript
)
override

Runs the given JavaScript in the context of the current page, and returns the result.

The Future completes with an error if a JavaScript error occurred, or if the type the given expression evaluates to is unsupported. Unsupported values include certain non-primitive types on iOS, as well as undefined or null on iOS 14+.

Implementation

@override
Future<String> runJavascriptReturningResult(String javascript) {
  return _channel
      .invokeMethod<String>('runJavascriptReturningResult', javascript)
      .then((String? result) => result!);
}