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

Update platform_specific_instructions.md: Add 'Why' explanations for better understanding #531

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions doc/dev_guide/platform_specific_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,36 @@ android {
}
```

## Web
For more information on multidex support, you can refer to the Android developer guide on [Configuring Multidex](https://developer.android.com/studio/build/multidex).

Running it on web requires the following modification in the local cached code of `printing` package.
## Web

If you're building a Flutter app for the web, you may encounter a build error like:

```
Launching lib/main.dart on Chrome in debug mode...
../../../.pub-cache/hosted/pub.dev/printing-5.13.4/lib/printing_web.dart:218:16: Error:
A value of type 'JSString' can't be assigned to a variable of type 'String'.
.toJS;
^
Failed to compile application.
```

This happens because `.toJS` is no longer required for converting Dart strings to JavaScript strings in recent Dart versions.

**Fix:**
Update the `printing_web.dart` file in the cached `printing` package by removing `.toJS` as done in the PR [here](https://github.com/DavBfr/dart_pdf/pull/1739/files)

```dart
script.innerHTML =
'''function ${_frameId}_print(){var f=document.getElementById('$_frameId');f.focus();f.contentWindow.print();}'''
.toJS;
```

Change it to:
```dart
script.innerHTML =
'''function ${_frameId}_print(){var f=document.getElementById('$_frameId');f.focus();f.contentWindow.print();}''';
```

Read more about it here - https://github.com/DavBfr/dart_pdf/issues/1791