evaluateJavascriptWithResolve method
고유한 세션 키로 script
를 evaluate한 후, JavascriptChannel로 받은 해당 세션 키의 params를 Future로 반환
Implementation
Future<dynamic> evaluateJavascriptWithResolve(String script) async {
final sessionKey = DateTime.now().millisecondsSinceEpoch;
Future<dynamic> resolved = eventManager.waitForResolveWithKey(sessionKey);
evaluateJavascript('''
window.PaymentWidgetFlutterSDK.message.postMessage(JSON.stringify({
name : 'resolve',
params : {
key : '$sessionKey',
data : $script
}
}));
true;
''');
return await resolved;
}