Closed alhamed1 closed 3 years ago
Hm very interesting... I'm not even sure if this is a opus_flutter
problem or a web_ffi
problem. While opus_flutter
injects js code to the page using inject_js
, this is done with JavaScript code from the asset folder at runtime and should thus not be subject to any minification... You can read more about this process here if you are interessted.
Can you reopen the issue at web_ffi
? I will answer it there.
Yes, you're right. I did some debugging and I found out that the type comparison is the problem in types.dart
int sizeOf<T extends NativeType>() {
if (_isPointerType<T>()) {
size = sizeMap[IntPtr];
} else {
size = sizeMap[T];
}
print('size: $size');
if (size != null) {
return size;
} else {
throw new ArgumentError('The type $T is not known!');
}
}
bool _isPointerType<T extends NativeType>() => // needs to address the changes that resulted from minification
T.toString().startsWith('Pointer<');
bool _isNativeFunctionType<T extends NativeType>() => // here also
T.toString().startsWith('NativeFunction<');
bool _isVoidType<T extends NativeType>() => T.toString() == 'Void'; // here also
I will reopen the issue in web_ffi
It works in a debug and a profile builds, but not in a release build because the javascript code minified.
Code:
Browser console output:
Flutter doctor --verbose: [√] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.19042.985], locale en-AE) • Flutter version 2.2.2 at C:\flutter • Framework revision d79295af24 (3 weeks ago), 2021-06-11 08:56:01 -0700 • Engine revision 91c9fc8fe0 • Dart version 2.13.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at D:\Android\sdk • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = D:\Android\sdk • ANDROID_SDK_ROOT = D:\Android\sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] IntelliJ IDEA Community Edition (version 2020.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1.3 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart
[√] IntelliJ IDEA Ultimate Edition (version 2021.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.2 • Flutter plugin version 57.0.5 • Dart plugin version 211.7665
[√] VS Code (version 1.57.1) • VS Code at C:\Users\ahmed\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.23.0
[√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.124 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.59
• No issues found!