fluttercommunity / flutter_webview_plugin

Community WebView Plugin - Allows Flutter to communicate with a native WebView.
https://pub.dev/packages/flutter_webview_plugin
Other
1.48k stars 930 forks source link

window.Print.postMessage is undefined #775

Open krcgk opened 4 years ago

krcgk commented 4 years ago

System info

Issue occurs on: both Plugin version: 0.3.11 Flutter doctor output:

[✓] Flutter (Channel unknown, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8)
    • Flutter version 1.12.13+hotfix.9 at /media/user/disk3/Applications/flutter
    • Framework revision f139b11009 (3 months ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /media/user/disk3/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /media/user/disk3/Android/Sdk
    • ANDROID_SDK_ROOT = /media/user/disk3/Android/Sdk
    • Java binary at: /snap/android-studio/90/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at /snap/android-studio/90/android-studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Android Studio (version 3.6)
    • Android Studio at /snap/android-studio/88/android-studio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • Redmi 5 Plus • 0d559abd9905 • android-arm64 • Android 8.1.0 (API 27)

Hi,

I have a problem at loaded html page. My javascript code is here

      if (window.Print !== undefined) {
        window.Print.postMessage(JSON.stringify({
          event: 'polygonCreated',
          coordinates: currentCoordinates.map(function (currentCoordinate) {
            return [currentCoordinate.lat, currentCoordinate.lng];
          }),
        }));
      } else {
        alert('Error');
      }

type of window.Print is object but I cant access Print.postMessage at release mode. It's working in debug mode but at release mode doesn't work

Logs

I dont have any logs because no error