Skip to content

Commit 05b22f3

Browse files
authored
Merge pull request #531 from AffanShaikhsurab/patch-1
Update platform_specific_instructions.md: Add 'Why' explanations for better understanding
2 parents 81fc65c + 1ff6baa commit 05b22f3

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

doc/dev_guide/platform_specific_instructions.md

+30-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,36 @@ android {
3939
}
4040
```
4141

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

44-
Running it on web requires the following modification in the local cached code of `printing` package.
44+
## Web
45+
46+
If you're building a Flutter app for the web, you may encounter a build error like:
47+
48+
```
49+
Launching lib/main.dart on Chrome in debug mode...
50+
../../../.pub-cache/hosted/pub.dev/printing-5.13.4/lib/printing_web.dart:218:16: Error:
51+
A value of type 'JSString' can't be assigned to a variable of type 'String'.
52+
.toJS;
53+
^
54+
Failed to compile application.
55+
```
56+
57+
This happens because `.toJS` is no longer required for converting Dart strings to JavaScript strings in recent Dart versions.
58+
59+
**Fix:**
60+
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)
61+
62+
```dart
63+
script.innerHTML =
64+
'''function ${_frameId}_print(){var f=document.getElementById('$_frameId');f.focus();f.contentWindow.print();}'''
65+
.toJS;
66+
```
67+
68+
Change it to:
69+
```dart
70+
script.innerHTML =
71+
'''function ${_frameId}_print(){var f=document.getElementById('$_frameId');f.focus();f.contentWindow.print();}''';
72+
```
4573

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

0 commit comments

Comments
 (0)