After adding the syncfusion_flutter_datagrid
, printing
and pdf
packages, When building for web I get the following error:
I have run flutter clean && flutter pub get
but it didn't help. I also tried adding ffi
to pubspec.yml
.
Compiling lib/main.dart for the Web... 16.0s
Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead.
/root/.pub-cache/hosted/pub.dartlang.org/archive-3.3.3/lib/src/util/aes_decrypt.dart:1:8:
Error: Not found: 'dart:ffi'
import 'dart:ffi';
^
/root/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_datagrid-20.3.56/lib/src/datagrid_widget/widgets/cell_widget.dart:695:19:
Warning: Operand of null-aware operation '!' has type 'OverlayState' which excludes null.
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('/usr/local/flutter/packages/flutter/lib/src/widgets/overlay.dart').
Overlay.of(context)!.context.findRenderObject()! as RenderBox;
^
Error: Compilation failed.
Exception: Failed to compile application for the Web.
The command '/bin/sh -c flutter build web' returned a non-zero code: 1
mark@mark-desktop:~/dev/example/cmd/client$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.7, on Ubuntu 22.04.1 LTS 5.15.0-52-generic, locale en_AU.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.3)
[✓] VS Code
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!
edit: I remove the syncfusion_data_grid
but continue to get the same error.
Well.. it's pretty hard to pin-point the exact reason without the specific version for each package used in your project. HOWEVER, it seems like a common issue that occurs whenever a sub-dependency is configures to an old version that causes trouble.
Following this great post it seems that you need to upgrade your packages to avoid this error. Please follow these steps:
flutter pub upgrade
flutter pub upgrade --major-versions
Needles to say that you should verify that you have proper access to your file system in order to avoid read / write issues due to insufficient permissions