Closed nirmal-kc closed 1 month ago
same issue with me
same issue with me. anyone get solution ?
same issue
The issue is thrown from printing_web.dart line no 196.
final isSafari = web.window['safari'].isUndefinedOrNull &&
!userAgent.contains(RegExp(r'Version/14\.1\.'));
Replacing it with a simple try/catch block fixed the issue.
bool isSafari;
try {
isSafari = web.window['safari'].isUndefinedOrNull &&
!userAgent.contains(RegExp(r'Version/14\.1\.'));
} catch (e) {
isSafari = false;
}
Can any of the contributors push this code to the repo? Thanks in advance.
Thanks nirmal-kc for your answer. It partially solved the problem for me. It only generates the PDF but the print window does not appear.
@blakix : My bad, I checked it in a hurry. Please replace the code for isChrome and isSafari as shown below. Let me know incase of any concerns.
final userAgent = web.window.navigator.userAgent;
//UserAgent can contain both Chrome and Safari for Chrome browser.
//Ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
final isChrome = userAgent.contains('Chrome');
//UserAgent contains only Safari for Safari browser.
//Ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14
final isSafari =
userAgent.contains('Safari') && !userAgent.contains('Chrome');
@nirmal-kc thanks now its working fine
Thanks nirmal-kc for all. It is perfect now. Thank you👌 find file here: C:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\printing-5.13.3\lib\printing_web.dart
Pushed to master.
Hi, I would like to know in which version this fix will come out.
Describe the bug Printing fails on Web, with the error "TypeError: null: type 'Null' is not a subtype of type 'JSObject'"
To Reproduce Download the latest code from GitHub repo. And run it on the latest version of Flutter
Expected behavior The print window must open.
Screenshots Flutter Doctor
Desktop (please complete the following information):