Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix latest dart2js and dart2wasm failing to compile due to invalid method signatures detected (#1326) #1329

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

Conversation

SleepySquash
Copy link

@SleepySquash SleepySquash commented Sep 19, 2024

This PR fixes #1326 (just_audio_web issue with latest dart2js and dart2wasm compilers) by adding more strict type signature to the functions. Dart incorrectly decides that (event) is a dynamic type, thus failing to compile. Refactoring that to (Event event) fixes the issue.

If there's anything else I can or should do, please, let me know!

@SleepySquash
Copy link
Author

SleepySquash commented Sep 19, 2024

Can validate the changes do indeed fix the issue on the Flutter 3.26.0-1.0.pre.152.

Without dependencies override:

Target dart2js failed: ProcessException: Process exited abnormally with exit code 1:
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:120:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:125:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:130:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: '*Future<Null>* Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:136:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:141:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:146:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:151:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:157:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
../../../.pub-cache/hosted/pub.dev/just_audio_web-0.4.12/lib/just_audio_web.dart:162:11:
Error: Function converted via 'toJS' contains invalid types in its function signature: 'Null Function(*dynamic*)'.
        }.toJS);
          ^
Error: Compilation failed.
Compiling lib/main.dart for the Web...                             16.7s
Error: Failed to compile application for the Web.

WIth the override:

  just_audio_web:
    git:
      url: https://github.com/SleepySquash/just_audio
      path: just_audio_web
      ref: 1326-improve-web-methods-signature
Compiling lib/main.dart for the Web...                             58.5s
✓ Built build/web

@SleepySquash SleepySquash marked this pull request as ready for review September 19, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with just_audio_web
1 participant