在添加syncfusion_flutter_datagrid、printing和pdf包后,在构建web时会出现以下错误:
我运行过flutter clean && flutter pub get,但没有帮助。我还尝试将ffi添加到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: 1mark@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!编辑:我删除了syncfusion_data_grid,但是继续得到相同的错误。
发布于 2022-11-26 21:13:06
好吧..。如果没有项目中使用的每个包的具体版本,就很难指出确切的原因。然而,这似乎是一个常见的问题,每当一个子依赖被配置到一个旧的版本,造成麻烦。
遵循此伟大的职位,您似乎需要升级您的包以避免此错误。请遵循以下步骤:
flutter pub upgradeflutter pub upgrade --major-versions提示您应该验证您是否能够正确访问您的文件系统,以避免权限不足导致的读/写问题。
https://stackoverflow.com/questions/74407459
复制相似问题