Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Bug fix callJsMethod: Encode/decode JSON when passing data between languages #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabrc52
Copy link

@gabrc52 gabrc52 commented Jul 9, 2022

Fixes #76

This should also allow passing maps, lists, ints, and doubles between languages but only on Android.

On iOS, it's possible to pass them as parameters to JS functions. But returning lists and maps from JS to Dart will return odd strings generated by Swift/ObjC. I decided to keep the old (but not buggy with strings anymore) behavior here, because type information is lost (i.e. it doesn't distinguish between a 42 and a '42'). So something further should be done, like statically allowing only Strings or doing manual parsing.

https://pub.dev/documentation/webview_flutter/latest/webview_flutter/WebViewController/evaluateJavascript.html:

image

@gabrc52
Copy link
Author

gabrc52 commented Jul 9, 2022

This is a breaking change on Android when non-Strings are returned from JS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bugs when passing through a string with \n or " on mobile - inconsistent behavior between platforms
1 participant