DartCallback class
Registers a Dart callback, which can be called from the Javascript side. This will be turned into a platform-specific dart callback, on runtime.
Usage:
WebViewX(
...
dartCallbacks: {
DartCallback(
name: 'Unique_Name_Here',
callBack: (message) => print(message),
),
},
...
),
And then, from the Javascript side, when you need to call back Dart from JS:
Calling Dart from JS, on Web:
Unique_Name_Here('test');
Calling Dart from JS, on Mobile:
Unique_Name_Here.postMessage('test');
For more about the Web and Mobile different call types see EmbeddedJsContent
Constructors
- DartCallback({required String name, required dynamic callBack(dynamic message)})
-
Constructor
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override